本文整理匯總了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)))