Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cordova-promise-fs

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cordova-promise-fs - npm Package Compare versions

Comparing version 0.9.0 to 0.10.0

2

bower.json
{
"name": "cordova-promise-fs",
"main": "dist/CordovaPromiseFS.js",
"version": "0.9.0",
"version": "0.10.0",
"homepage": "https://github.com/markmarijnissen/cordova-promise-fs",

@@ -6,0 +6,0 @@ "authors": [

@@ -75,2 +75,3 @@ var CordovaPromiseFS =

function normalize(str){
str = str || '';
if(str[0] === '/') str = str.substr(1);

@@ -116,6 +117,7 @@ if(!!str && str.indexOf('.') < 0 && str[str.length-1] !== '/') str += '/';

xhr.open('GET', url);
xhr.responseType = "blob";
xhr.onreadystatechange = function(onSuccess, onError, cb) {
if (xhr.readyState == 4) {
if(xhr.status === 200){
write(file,xhr.responseText).then(win,fail);
write(file,xhr.response).then(win,fail);
} else {

@@ -147,3 +149,12 @@ fail(xhr.status);

deviceready.then(function(){
window.requestFileSystem(options.persistent? 1: 0, options.storageSize, resolve, reject);
var type = options.persistent? 1: 0;
if(typeof options.fileSystem === 'number'){
type = options.fileSystem;
}
// Chrome only supports persistent and temp storage, not the exotic onces from Cordova
if(!isCordova && type > 1) {
console.warn('Chrome does not support fileSystem "'+type+'". Falling back on "0" (temporary).');
type = 0;
}
window.requestFileSystem(type, options.storageSize, resolve, reject);
setTimeout(function(){ reject(new Error('Could not retrieve FileSystem after 5 seconds.')); },5100);

@@ -178,5 +189,8 @@ },reject);

function file(path,options){
path = normalize(path);
options = options || {};
return new Promise(function(resolve,reject){
if(path instanceof FileEntry) {
return resolve(path);
}
path = normalize(path);
options = options || {};
return fs.then(function(fs){

@@ -183,0 +197,0 @@ fs.root.getFile(path,options,resolve,reject);

@@ -28,2 +28,3 @@ /**

function normalize(str){
str = str || '';
if(str[0] === '/') str = str.substr(1);

@@ -69,6 +70,7 @@ if(!!str && str.indexOf('.') < 0 && str[str.length-1] !== '/') str += '/';

xhr.open('GET', url);
xhr.responseType = "blob";
xhr.onreadystatechange = function(onSuccess, onError, cb) {
if (xhr.readyState == 4) {
if(xhr.status === 200){
write(file,xhr.responseText).then(win,fail);
write(file,xhr.response).then(win,fail);
} else {

@@ -100,3 +102,12 @@ fail(xhr.status);

deviceready.then(function(){
window.requestFileSystem(options.persistent? 1: 0, options.storageSize, resolve, reject);
var type = options.persistent? 1: 0;
if(typeof options.fileSystem === 'number'){
type = options.fileSystem;
}
// Chrome only supports persistent and temp storage, not the exotic onces from Cordova
if(!isCordova && type > 1) {
console.warn('Chrome does not support fileSystem "'+type+'". Falling back on "0" (temporary).');
type = 0;
}
window.requestFileSystem(type, options.storageSize, resolve, reject);
setTimeout(function(){ reject(new Error('Could not retrieve FileSystem after 5 seconds.')); },5100);

@@ -131,5 +142,8 @@ },reject);

function file(path,options){
path = normalize(path);
options = options || {};
return new Promise(function(resolve,reject){
if(path instanceof FileEntry) {
return resolve(path);
}
path = normalize(path);
options = options || {};
return fs.then(function(fs){

@@ -136,0 +150,0 @@ fs.root.getFile(path,options,resolve,reject);

{
"name": "cordova-promise-fs",
"version": "0.9.0",
"version": "0.10.0",
"description": "Cordova FileSystem convienence functions that return promises.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -141,2 +141,6 @@ cordova-promise-fs

### 0.10.0 (21/12/2014)
* Support for other fileSystems (undocumented hack)
### 0.9.0 (28/11/2014)

@@ -143,0 +147,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc