@frontle/cordova-fileutil
v1.0.2
Published
'cordova-plugin-file' easily
Downloads
17
Readme
Description
'cordova-plugin-file' easily
Usage
import { getDirEntry, getFileEntry, read, write, remove, removeDir } from "../../browser_modules/@frontle/cordova-fileutil/index.js";
// get directory entry
const dirEntry = await getDirEntry(cordova.file.dataDirectory, 'testFolder');
// get file entry
const fileEntry = await getFileEntry('test.text', dirEntry);
// read file
const readData = await read(fileEntry);
// write file
await write(fileEntry, "test text");
// remove file
await remove('test.text', dirEntry);
// remove directory
await removeDir(dirEntry);
Install
Frontle
$ frontle install @frontle/cordova-fileutil --noBuild
Download Vanilla JS Library
https://github.com/Frontle-Foundation/cordova-fileutil
API
getDirEntry(path, folderName, create = true)
Get directory entry
const dirEntry = await getDirEntry(cordova.file.dataDirectory, 'testFolder');
getFileEntry(fileName, dirEntry, create = true)
Get file entry
const fileEntry = await getFileEntry('test.text', dirEntry);
read(fileEntry)
Read file data
const readData = await read(fileEntry);
write(fileEntry, writeData)
Write file data
await write(fileEntry, "test text");
remove(fileName, dirEntry)
Remove file
await remove('test.text', dirEntry);
removeDir(dirEntry)
Remove directory
await removeDir(dirEntry);
People
The original author of @frontle/cordova-fileutil is MushStory