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.48 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

const cordovaFileUtil = CordovaFileUtil.getInstance();

// 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

For typical cordova projects, copy and use the code at cordovaFileUtil.js in this repository

https://github.com/Artifriends-inc/cordova-FileUtil

How to install with Frontle

$ frontle install-original cordova-fileutil

Function

getInstance()

Get "CordovaFileUtil" object

Only one object is created using a single-tone pattern

const cordovaFileUtil = CordovaFileUtil.getInstance();
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');
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(fileName, 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 01 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