當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript File.writeFile方法代碼示例

本文整理匯總了TypeScript中@ionic-native/file.File.writeFile方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript File.writeFile方法的具體用法?TypeScript File.writeFile怎麽用?TypeScript File.writeFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@ionic-native/file.File的用法示例。


在下文中一共展示了File.writeFile方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: writeFileFromBase64

 // here is the method is used to write a file in storage
 // https://www.c-sharpcorner.com/article/how-to-save-picture-to-specific-path-in-ionic-3-using-native-camera-plugin/
 public writeFileFromBase64(base64Data: any, filePath: string, fileName?: string): void {
   let contentType: any = this.getContentType(base64Data);
   let dataBlob: Blob = this.base64toBlob(base64Data.split(',')[1], contentType);
   // TODO dummy random name implementation
   let newFileName: string = fileName ? fileName : Math.floor(Math.random()*Number.MAX_SAFE_INTEGER)+'.jpeg';
   this.file.writeFile(filePath, newFileName, dataBlob, contentType).then((success) => {
     console.log('File Writed Successfully to location: ' + filePath + newFileName);
   }).catch((err) => {
     console.log('Error Occured While Writing File: '+ filePath + newFileName, err.message);
   })
 }
開發者ID:exodinn,項目名稱:StarterKit,代碼行數:13,代碼來源:file-service.ts

示例2: fixFileReader

const writeToFile = (path, filename, data: Blob | string) => {
	fixFileReader()
	return FILE.writeFile(path, filename, data)
}
開發者ID:whispeer,項目名稱:app,代碼行數:4,代碼來源:blobCache.ts

示例3: Observable

 return new Observable(observer => {
   this.file.writeFile(this.file.dataDirectory, filePath, text)
     .then((success) => observer.next(success))
     .catch((error) => observer.error(error));
 });
開發者ID:CIRDLES,項目名稱:CHRONI,代碼行數:5,代碼來源:FileUtility.ts

示例4:

                    promise = Promise.all(filePromises).then(() => {
                        // File read and parent folder created, now write the file.
                        const parentFolder = this.textUtils.concatenatePaths(destination, fileDir);

                        return this.file.writeFile(parentFolder, fileName, fileData, {replace: true});
                    });
開發者ID:SATS-Seminary,項目名稱:moodlemobile2,代碼行數:6,代碼來源:zip.ts


注:本文中的@ionic-native/file.File.writeFile方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。