npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

cordova-plugin-simple-file

v1.2.0

Published

SimpleFile ==========

Readme

SimpleFile

SimpleFile is a Cordova plugin that lets you read and write files from the filesystem.

You can also create/remove directories, extract the URI from a file and download remote content to a file.

It currently features support for Android and iOS.

Install

From the root of a cordova project run:

$ cordova plugin add https://github.com/uniclau/SimpleFile.git 

Javascript API

The plugin exposes the window.plugins.simpleFile object. It provides access to different file systems through their corresponding object:

  • plugins.simpleFile.internal
    • Private files stored in the app's data folder. The content will not be saved in iCloud
    • On iOS: /var/mobile/Applications/<UUID>/Library/NoCloud
    • On Android: /data/data/<app-id>/files
  • plugins.simpleFile.internal
    • Private files stored in the app's data folder. The content will be saved in iCloud.
    • On iOS: /var/mobile/Applications/<UUID>/Library
    • On Android: /data/data/<app-id>/files
  • plugins.simpleFile.external
    • On Android, it provides access to the device's SD card. It defaults to the private app storage if no SD card is not present in older devices.
    • On iOS: /var/mobile/Applications/<UUID>/Library/NoCloud
      • iPhones do not have external memory cards. Same as the internal filesystem.
    • On Android: <sdcard>/
  • plugins.simpleFile.bundle
    • Files packaged in the app binary (i.e. www)
    • This file system is read only

Reading files

window.plugins.simpleFile.<fs>.read(fileName, successCallback, errorCallback)

Reads the contents of a file and provides them to the given successCallback.

Writing to a file

window.plugins.simpleFile.<fs>.write(fileName, contents, successCallback, errorCallback)

Writes the contents in contents to the path provided in fileName. This function will create any folders in fileName that do not exist yet.

Note: This will not work if you use it with the bundle filesystem.

Removing a file or folder

window.plugins.simpleFile.<fs>.remove(fileName, successCallback, errorCallback)

Removes the file or folder specified in fileName. If fileNameis a folder, all of its contents are removed as well.

Note: This will not work if you use it with the bundle filesystem.

Getting a file's URL

window.plugins.simpleFile.<fs>.getURL(fileName, successCallback, errorCallback)

Provides the URL to reference a file from inside the browser.

Downloading remote files

window.plugins.simpleFile.<fs>.download(url, fileName, successCallback, errorCallback)

Downloads a file and saves the contents to the file specified in fileName. This function will create any folders in fileName that do not exist yet.

Note: This will not work if you use it with the bundle filesystem.

Creating a folder

window.plugins.simpleFile.<fs>.createFolder(dirName, successCallback, errorCallback)

Creates a folder and all the parent directories that do not exist yet.

Note: This will not work if you use it with the bundle filesystem.

Listing folders

window.plugins.simpleFile.<fs>.list(folderName, successCallback, errorCallback)

Provides the successCallback function with an array of objects, containing the files and folders contained inside the folderName directory.

Every object in the array has the following structure:

{
	name: "file.txt",
	isFolder: false
}

To list the root directory, just set folderName to either "" or "."

Copying files or folders

window.plugins.simpleFile.copy(originFilesystem, originFileOrFolder, destinationFilesystem, destinationFileOrFolder, successCallback, errorCallback)

Copies the file or folder (with all its contents) to the given destination.

As an example:

window.plugins.simpleFile.copy('bundle', 'logo.png', 'internal', 'logo.png', successCallback, errorCallback)

General example

The next example copies the phonegap logo to the internal directory and sets that logo.png as the current page of the webView:

window.plugins.simpleFile.bundle.read("www/img/logo.png",function(data) {

	window.plugins.simpleFile.internal.write("logo.png", data, function() {

		window.plugins.simpleFile.internal.getUrl("logo.png", function(url) {
			alert(url);
			window.location.href = url;
		},function(err) {
			alert("ERROR in getUrl: "+err);
		});
	},function(err) {
		alert("ERROR: write: "+err);
	});
},function(err) {
	alert("ERROR: read: "+err);
});