Cordova shell give you an easy access to the device filesystem.
npm install cordova-shellCordova shell is a javascript wrapper around the Apache Cordova Plugin File to give you an easy access to the device filesystem.
For documentation see the definition file
``
shell.consoleLog(true);
shell.ls('cdvfile://localhost/persistent/');
shell.mkdir('cdvfile://localhost/persistent/data/');
shell.writeText('hello world', 'cdvfile://localhost/persistent/data/hello.txt');
shell.copy('cdvfile://localhost/persistent/data/hello.txt', cordova.file.dataDirectory);
shell.ls(cordova.file.dataDirectory);
shell.download('https://www.w3.org/TR/PNG/iso_8859-1.txt', 'cdvfile://localhost/persistent/data/iso.txt', progressCallback);
shell.readText('cdvfile://localhost/persistent/data/iso.txt')
shell.remove('cdvfile://localhost/persistent/data/iso.txt');
shell.remove('cdvfile://localhost/persistent/data/');
shell.fileTree('cdvfile://localhost/persistent/'); //return relative paths
shell.fileTree('cdvfile://localhost/persistent/', false); //return absolute paths
`
bash
cordova plugin add cordova-plugin-file
`
- Download cordova-shell.js and copy it to your cordova _www_ directory- reference the script in _www/index.html_
`html
`Import module
`
npm install cordova-shell
``js
import {shell} from 'cordova-shell';shell.ls("cdvfile://localhost/persistent").then(entries => {
console.log(entries);
});
``