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 0.2.1 to 0.2.2

2

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

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

@@ -172,35 +172,44 @@ var CordovaFileCache =

// augment progress event with index/total stats
var onSingleDownloadProgress;
if(typeof onprogress === 'function') {
onSingleDownloadProgress = function(ev){
ev.index = index;
ev.total = total;
onprogress(ev);
};
}
// callback
var onDone = function(){
index++;
// when we're done
if(index !== total) {
// reset downloads
self._downloading = [];
// check if we got everything
self.list().then(function(){
// Yes, we're not dirty anymore!
if(!self.isDirty()) {
resolve(self);
// Aye, some files got left behind!
} else {
reject(self.getDownloadQueue());
// download every file in the queue (which is the diff from _added with _cached)
queue.forEach(function(url){
var path = self.toPath(url);
// augment progress event with index/total stats
var onSingleDownloadProgress;
if(typeof onprogress === 'function') {
onSingleDownloadProgress = function(ev){
ev.queueIndex = index;
ev.queueSize = total;
ev.url = url;
ev.path = path;
ev.percentage = index / total;
if(ev.loaded > 0 && ev.total > 0 && index !== total){
ev.percentage += (ev.loaded / ev.total) / total;
}
},reject);
onprogress(ev);
};
}
};
// download every file in the queue (which is the diff from _added with _cached)
queue.forEach(function(url,index){
var download = fs.download(url,self.toPath(url),{retry:self._retry},onSingleDownloadProgress);
// callback
var onDone = function(){
index++;
// when we're done
if(index === total) {
// reset downloads
self._downloading = [];
// check if we got everything
self.list().then(function(){
// final progress event!
if(onSingleDownloadProgress) onSingleDownloadProgress(new ProgressEvent());
// Yes, we're not dirty anymore!
if(!self.isDirty()) {
resolve(self);
// Aye, some files got left behind!
} else {
reject(self.getDownloadQueue());
}
},reject);
}
};
var download = fs.download(url,path,{retry:self._retry},onSingleDownloadProgress);
download.then(onDone,onDone);

@@ -207,0 +216,0 @@ self._downloading.push(download);

@@ -125,35 +125,44 @@ var hash = require('./murmerhash');

// augment progress event with index/total stats
var onSingleDownloadProgress;
if(typeof onprogress === 'function') {
onSingleDownloadProgress = function(ev){
ev.index = index;
ev.total = total;
onprogress(ev);
};
}
// callback
var onDone = function(){
index++;
// when we're done
if(index !== total) {
// reset downloads
self._downloading = [];
// check if we got everything
self.list().then(function(){
// Yes, we're not dirty anymore!
if(!self.isDirty()) {
resolve(self);
// Aye, some files got left behind!
} else {
reject(self.getDownloadQueue());
// download every file in the queue (which is the diff from _added with _cached)
queue.forEach(function(url){
var path = self.toPath(url);
// augment progress event with index/total stats
var onSingleDownloadProgress;
if(typeof onprogress === 'function') {
onSingleDownloadProgress = function(ev){
ev.queueIndex = index;
ev.queueSize = total;
ev.url = url;
ev.path = path;
ev.percentage = index / total;
if(ev.loaded > 0 && ev.total > 0 && index !== total){
ev.percentage += (ev.loaded / ev.total) / total;
}
},reject);
onprogress(ev);
};
}
};
// download every file in the queue (which is the diff from _added with _cached)
queue.forEach(function(url,index){
var download = fs.download(url,self.toPath(url),{retry:self._retry},onSingleDownloadProgress);
// callback
var onDone = function(){
index++;
// when we're done
if(index === total) {
// reset downloads
self._downloading = [];
// check if we got everything
self.list().then(function(){
// final progress event!
if(onSingleDownloadProgress) onSingleDownloadProgress(new ProgressEvent());
// Yes, we're not dirty anymore!
if(!self.isDirty()) {
resolve(self);
// Aye, some files got left behind!
} else {
reject(self.getDownloadQueue());
}
},reject);
}
};
var download = fs.download(url,path,{retry:self._retry},onSingleDownloadProgress);
download.then(onDone,onDone);

@@ -160,0 +169,0 @@ self._downloading.push(download);

{
"name": "cordova-file-cache",
"version": "0.2.1",
"version": "0.2.2",
"description": "Cordova File Cache",

@@ -22,4 +22,4 @@ "main": "index.js",

"dependencies": {
"cordova-promise-fs": "^0.5.0"
"cordova-promise-fs": "^0.5.1"
}
}

@@ -5,2 +5,3 @@ cordova-file-cache

Based on [cordova-promise-fs](https://github.com/markmarijnissen/cordova-promise-fs).

@@ -7,0 +8,0 @@ ## Getting started

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