本文整理匯總了TypeScript中@ionic-native/file.File.removeFile方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript File.removeFile方法的具體用法?TypeScript File.removeFile怎麽用?TypeScript File.removeFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@ionic-native/file.File
的用法示例。
在下文中一共展示了File.removeFile方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: resolve
return new Promise<void>((resolve, reject) => {
this.file.removeFile(this.dir.nativeURL, k).then( () => {
this.log.debug('File removed: ' + k);
resolve();
}).catch( (e) => {
this.log.error(e);
reject(e);
});
});
示例2: resolve
return new Promise<void>((resolve, reject) => {
this.file
.removeFile(this.dir.nativeURL, k)
.then(() => {
this.log.debug(`Storage Key: ${k} removed`);
resolve();
})
.catch(e => {
reject(e);
});
});
示例3: Observable
return new Observable(observer => {
let dir: string;
switch(directory) {
case "data":
dir = this.file.dataDirectory;
break;
case "temp":
dir = this.file.tempDirectory;
break;
case "cache":
dir = this.file.cacheDirectory;
break;
}
this.file.removeFile(dir, filePath)
.then((success) => observer.next(success))
.catch((error) => observer.error(error));
});
示例4: getCacheDirectory
return Bluebird.try(async () => {
const cacheDir = await getCacheDirectory()
const blobFile = idToFileName(blobID)
const path = isAndroid() ? `${FILE.externalRootDirectory}Download/` : `${FILE.documentsDirectory}`
const existsSource = await existsFile(cacheDir, blobFile)
const existsDestination = await existsFile(path, filename)
if (!existsSource) {
throw new Error(`cannot copy blob, blob does not exist: ${filename}`)
}
if (existsDestination) {
await FILE.removeFile(path, filename)
}
await FILE.copyFile(cacheDir, blobFile, path, filename)
return `${path}${filename}`
})
示例5: Observable
return new Observable(observer => {
this.file.removeFile(this.file.dataDirectory, filePath)
.then((success) => observer.next(success))
.catch((error) => observer.error(error));
});