cordova-fileutil
'cordova-plugin-file' easily
Usage
import {CordovaFileUtil} from "cordovaFileUtil.js";
const cordovaFileUtil = new CordovaFileUtil();
const dirEntry = await cordovaFileUtil.getDirEntry(cordova.file.dataDirectory, 'testFolder');
const fileEntry = await cordovaFileUtil.getFileEntry('test.text', dirEntry);
const readData = await cordovaFileUtil.read(fileEntry);
await cordovaFileUtil.write(fileEntry, "test text");
await cordovaFileUtil.remove('test.text', dirEntry);
await cordovaFileUtil.removeDir(dirEntry);
Install
NPM
npm install cordova-fileutil
Frontle
frontle install cordova-fileutil
Download file
https://github.com/Artifriends-inc/cordova-FileUtil
API
new CordovaFileUtil()
Creating a CordovaFileUtil Object. Single tone pattern used
const cordovaFileUtil = new CordovaFileUtil();
.getDirEntry(path, folderName, create = true)
Get directory entry
const dirEntry = await cordovaFileUtil.getDirEntry(cordova.file.dataDirectory, 'testFolder');
.getFileEntry(fileName, dirEntry, create = true)
Get file entry
const fileEntry = await cordovaFileUtil.getFileEntry('test.text', dirEntry);
.read(fileEntry)
Read file data
const readData = await cordovaFileUtil.read(fileEntry);
.write(fileEntry, writeData)
Write file data
await cordovaFileUtil.write(fileEntry, "test text");
.remove(fileName, dirEntry)
Remove file
await cordovaFileUtil.remove('test.text', dirEntry);
.removeDir(dirEntry)
Remove directory
await cordovaFileUtil.removeDir(dirEntry);
People
The original author of cordova-fileutil is MushStory
License
MIT