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

cordova-file-cache

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cordova-file-cache - npm Package Compare versions

Comparing version 1.1.1 to 1.2.1

2

bower.json
{
"name": "cordova-file-cache",
"main": "dist/CordovaFileCache.js",
"version": "0.12.0",
"version": "1.2.0",
"homepage": "https://github.com/markmarijnissen/cordova-file-cache",

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

@@ -50,3 +50,2 @@ var CordovaFileCache =

var Promise = null;
var isCordova = typeof cordova !== 'undefined';

@@ -58,3 +57,3 @@ /* Cordova File Cache x */

this._fs = options.fs;
if(!this._fs) {
if(!this._fs) {
throw new Error('Missing required option "fs". Add an instance of cordova-promise-fs.');

@@ -83,3 +82,3 @@ }

.then(function(entry){
self.localInternalURL = isCordova? entry.toInternalURL(): entry.toURL();
self.localInternalURL = typeof entry.toInternalURL === 'function'? entry.toInternalURL(): entry.toURL();
self.localUrl = entry.toURL();

@@ -104,3 +103,3 @@ return self.list();

self._cached[fullPath] = {
toInternalURL: isCordova? entry.toInternalURL(): entry.toURL(),
toInternalURL: typeof entry.toInternalURL === 'function'? entry.toInternalURL(): entry.toURL(),
toURL: entry.toURL(),

@@ -185,2 +184,3 @@ };

var percentage = 0;
var errors = [];

@@ -211,3 +211,3 @@ // download every file in the queue (which is the diff from _added with _cached)

done++;
onSingleDownloadProgress(new ProgressEvent());
if(onSingleDownloadProgress) onSingleDownloadProgress(new ProgressEvent());

@@ -227,3 +227,3 @@ // when we're done

} else {
reject(self.getDownloadQueue());
reject(errors);
}

@@ -233,6 +233,12 @@ },reject);

};
var onErr = function(err){
if(err && err.target && err.target.error) err = err.target.error;
errors.push(err);
onDone();
};
var downloadUrl = url;
if(self._cacheBuster) downloadUrl += "?"+Date.now();
var download = fs.download(downloadUrl,path,{retry:self._retry},includeFileProgressEvents? onSingleDownloadProgress: undefined);
download.then(onDone,onDone);
var download = fs.download(downloadUrl,path,{retry:self._retry},includeFileProgressEvents && onSingleDownloadProgress? onSingleDownloadProgress: undefined);
download.then(onDone,onErr);
self._downloading.push(download);

@@ -268,3 +274,3 @@ });

FileCache.prototype.toInternalURL = function toInternalURL(url){
path = this.toPath(url);
var path = this.toPath(url);
if(this._cached[path]) return this._cached[path].toInternalURL;

@@ -275,3 +281,3 @@ return url;

FileCache.prototype.get = function get(url){
path = this.toPath(url);
var path = this.toPath(url);
if(this._cached[path]) return this._cached[path].toURL;

@@ -286,3 +292,3 @@ return this.toServerURL(url);

FileCache.prototype.toURL = function toURL(url){
path = this.toPath(url);
var path = this.toPath(url);
return this._cached[path]? this._cached[path].toURL: url;

@@ -292,3 +298,3 @@ };

FileCache.prototype.toServerURL = function toServerURL(path){
path = this._fs.normalize(path);
var path = this._fs.normalize(path);
return path.indexOf('://') < 0? this.serverRoot + path: path;

@@ -314,5 +320,7 @@ };

} else {
var ext = url.substr(url.lastIndexOf('.'));
if ((ext.indexOf("?") > 0) || (ext.indexOf("/") > 0)) {
ext = ".txt";
var ext = url.match(/\.[a-z]{1,}/g);
if (ext) {
ext = ext[ext.length-1];
} else {
ext = '.txt';
}

@@ -325,2 +333,3 @@ return this.localRoot + hash(url) + ext;

/***/ },

@@ -327,0 +336,0 @@ /* 1 */

var hash = require('./murmerhash');
var Promise = null;
var isCordova = typeof cordova !== 'undefined';

@@ -10,3 +9,3 @@ /* Cordova File Cache x */

this._fs = options.fs;
if(!this._fs) {
if(!this._fs) {
throw new Error('Missing required option "fs". Add an instance of cordova-promise-fs.');

@@ -35,3 +34,3 @@ }

.then(function(entry){
self.localInternalURL = isCordova? entry.toInternalURL(): entry.toURL();
self.localInternalURL = typeof entry.toInternalURL === 'function'? entry.toInternalURL(): entry.toURL();
self.localUrl = entry.toURL();

@@ -56,3 +55,3 @@ return self.list();

self._cached[fullPath] = {
toInternalURL: isCordova? entry.toInternalURL(): entry.toURL(),
toInternalURL: typeof entry.toInternalURL === 'function'? entry.toInternalURL(): entry.toURL(),
toURL: entry.toURL(),

@@ -137,2 +136,3 @@ };

var percentage = 0;
var errors = [];

@@ -163,3 +163,3 @@ // download every file in the queue (which is the diff from _added with _cached)

done++;
onSingleDownloadProgress(new ProgressEvent());
if(onSingleDownloadProgress) onSingleDownloadProgress(new ProgressEvent());

@@ -179,3 +179,3 @@ // when we're done

} else {
reject(self.getDownloadQueue());
reject(errors);
}

@@ -185,6 +185,12 @@ },reject);

};
var onErr = function(err){
if(err && err.target && err.target.error) err = err.target.error;
errors.push(err);
onDone();
};
var downloadUrl = url;
if(self._cacheBuster) downloadUrl += "?"+Date.now();
var download = fs.download(downloadUrl,path,{retry:self._retry},includeFileProgressEvents? onSingleDownloadProgress: undefined);
download.then(onDone,onDone);
var download = fs.download(downloadUrl,path,{retry:self._retry},includeFileProgressEvents && onSingleDownloadProgress? onSingleDownloadProgress: undefined);
download.then(onDone,onErr);
self._downloading.push(download);

@@ -220,3 +226,3 @@ });

FileCache.prototype.toInternalURL = function toInternalURL(url){
path = this.toPath(url);
var path = this.toPath(url);
if(this._cached[path]) return this._cached[path].toInternalURL;

@@ -227,3 +233,3 @@ return url;

FileCache.prototype.get = function get(url){
path = this.toPath(url);
var path = this.toPath(url);
if(this._cached[path]) return this._cached[path].toURL;

@@ -238,3 +244,3 @@ return this.toServerURL(url);

FileCache.prototype.toURL = function toURL(url){
path = this.toPath(url);
var path = this.toPath(url);
return this._cached[path]? this._cached[path].toURL: url;

@@ -244,3 +250,3 @@ };

FileCache.prototype.toServerURL = function toServerURL(path){
path = this._fs.normalize(path);
var path = this._fs.normalize(path);
return path.indexOf('://') < 0? this.serverRoot + path: path;

@@ -266,5 +272,7 @@ };

} else {
var ext = url.substr(url.lastIndexOf('.'));
if ((ext.indexOf("?") > 0) || (ext.indexOf("/") > 0)) {
ext = ".txt";
var ext = url.match(/\.[a-z]{1,}/g);
if (ext) {
ext = ext[ext.length-1];
} else {
ext = '.txt';
}

@@ -275,2 +283,2 @@ return this.localRoot + hash(url) + ext;

module.exports = FileCache;
module.exports = FileCache;
{
"name": "cordova-file-cache",
"version": "1.1.1",
"version": "1.2.1",
"description": "Cordova File Cache",

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

@@ -137,2 +137,6 @@ cordova-file-cache

### 1.2.0
* Return errors when not all files are loaded instead of empty array
### 1.1.0

@@ -139,0 +143,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