本文整理汇总了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));
});