Socket
Socket
Sign inDemoInstall

cordova-fileutil

Package Overview
Dependencies
0
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    cordova-fileutil

This package makes it easy to use the 'cordova-plugin-file' plug-in


Version published
Maintainers
1
Install size
7.68 kB
Created

Readme

Source

cordova-FileUtil

This package makes it easy to use the "cordova-plugin-file" plug-in

NPM Version

NPM Install Size

NPM Downloads

import {CordovaFileUtil} from "../../frontle/browser_modules/cordova-fileutil/cordovaFileUtil.js";


// get instance
const cordovaFileUtil = new CordovaFileUtil();

// get directory entry
const dirEntry = cordovaFileUtil.getDirEntry(cordova.file.dataDirectory, 'testFolder');

// get file entry
const fileEntry = cordovaFileUtil.getFileEntry('test.text', dirEntry);

// read file
const readData = cordovaFileUtil.read(fileEntry);

// write file
cordovaFileUtil.write(fileEntry, "test text");

// remove file
cordovaFileUtil.remove('test.text', dirEntry);

// remove directory
cordovaFileUtil.removeDir(dirEntry);

Installation

How to install from Frontle

$ frontle install cordova-fileutil

How to install from Web

For typical web projects, copy and use the code at cordovaFileUtil.js in below repositorys

https://github.com/Artifriends-inc/cordova-FileUtil (cordovaFileUtil.js)

Function

new CordovaFileUtil()

Get "CordovaFileUtil" object. only one object is created using a single-tone pattern

// get instance
const cordovaFileUtil = new CordovaFileUtil();
cordovaFileUtil.getDirEntry(path, folderName, create = true)

Get folder entry, If the "create" option is true, a folder is created

// get directory entry
const dirEntry = cordovaFileUtil.getDirEntry(cordova.file.dataDirectory, 'testFolder');
cordovaFileUtil.getFileEntry(fileName, dirEntry, create = true)

Get file entry, If the "create" option is true, a file is created

// get file entry
const fileEntry = cordovaFileUtil.getFileEntry('test.text', dirEntry);
read(fileEntry)

Reads file data

// read file
const readData = cordovaFileUtil.read(fileEntry);
write(fileEntry, writeData)

Write file data

// write file
cordovaFileUtil.write(fileEntry, "test text");
remove(fileName, dirEntry)

Remove file

// remove file
cordovaFileUtil.remove('test.text', dirEntry);
removeDir(dirEntry)

Remove directory

// remove directory
cordovaFileUtil.removeDir(dirEntry);

People

The original author of cordova-fileutil is MushStory

License

MIT

Keywords

FAQs

Last updated on 21 Jul 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc