本文整理汇总了TypeScript中react-native-fs.unlink函数的典型用法代码示例。如果您正苦于以下问题:TypeScript unlink函数的具体用法?TypeScript unlink怎么用?TypeScript unlink使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了unlink函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: test
test('clearAllDownload', () => {
testSaga(clearAllDownload)
.next()
.call(RNFS.readDir, FILES_FOLDER)
.next([{ path: 'wallace' }])
.call(Promise.all, [RNFS.unlink('wallace')])
.next()
.put({
type: 'download/tracks/set',
payload: []
})
.next()
.put(actions.toastAction('success', '所有下载项目都清除成功'))
.next()
.isDone()
})
示例2:
console.log(err.message, err.code);
});
// create a path you want to write to
const path = RNFS.DocumentDirectoryPath + '/test.txt';
// write the file
RNFS.writeFile(path, 'Lorem ipsum dolor sit amet', 'utf8')
.then(() => {
console.log('FILE WRITTEN!');
})
.catch((err) => {
console.log(err.message);
});
RNFS.unlink('path')
.then(() => {
console.log('FILE DELETED');
})
// `unlink` will throw an error, if the item to unlink does not exist
.catch((err) => {
console.log(err.message);
});
const uploadUrl = 'http://requestb.in/XXXXXXX'; // For testing purposes, go to http://requestb.in/ and create your own link
// create an array of objects of the files you want to upload
const files = [
{
name: 'test1',
filename: 'test1.w4a',
filepath: RNFS.DocumentDirectoryPath + '/test1.w4a',
示例3:
.then((fileExists) => {
if (fileExists) {
return RNFS.unlink(uri)
}
})
示例4: call
yield call(Promise.all, downloads.map((d) => RNFS.unlink(d.path)))