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

@loaders.gl/zip

Package Overview
Dependencies
Maintainers
8
Versions
332
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@loaders.gl/zip - npm Package Compare versions

Comparing version 0.8.0 to 1.0.0-alpha.1

18

dist/es5/zip-loader.js

@@ -17,4 +17,3 @@ "use strict";

parse: parseZipAsync
}; // TODO - Could return a map of promises, perhaps as an option...
};
exports.ZipLoader = ZipLoader;

@@ -27,16 +26,10 @@

return jsZip.loadAsync(data, options).then(function (zip) {
// start to load each file in this zip
zip.forEach(function (relativePath, zipEntry) {
var subFilename = zipEntry.name;
var promise = jsZip.file(subFilename) // jszip supports both arraybuffer and text, the main loaders.gl types
// https://stuk.github.io/jszip/documentation/api_zipobject/async.html
.async(options.dataType || 'arraybuffer').then(function (arrayBuffer) {
// Store file data in map
var promise = jsZip.file(subFilename).async(options.dataType || 'arraybuffer').then(function (arrayBuffer) {
fileMap[relativePath] = arrayBuffer;
}).catch(function (error) {
options.log.error("Unable to read ".concat(subFilename, " from zip archive: ").concat(error)); // Store error in place of data in map
options.log.error("Unable to read ".concat(subFilename, " from zip archive: ").concat(error));
fileMap[relativePath] = error;
}); // Ensure Promise.all doesn't ignore rejected promises.
});
promises.push(promise.catch(function (e) {

@@ -47,4 +40,3 @@ return e;

return Promise.all(promises);
}) // Return fileMap
.then(function () {
}).then(function () {
return fileMap;

@@ -51,0 +43,0 @@ }).catch(function (error) {

@@ -22,12 +22,9 @@ "use strict";

function encodeZipAsync(fileMap, options) {
var jsZip = new _jszip.default(); // add files to the zip
var jsZip = new _jszip.default();
for (var subFileName in fileMap) {
var subFileData = fileMap[subFileName]; // jszip supports both arraybuffer and string data (the main loaders.gl types)
// https://stuk.github.io/jszip/documentation/api_zipobject/async.html
var subFileData = fileMap[subFileName];
jsZip.file(subFileName, subFileData, options);
} // always generate the full zip as an arraybuffer
}
options = Object.assign({}, options, {

@@ -34,0 +31,0 @@ type: 'arraybuffer'

@@ -7,3 +7,3 @@ import JSZip from 'jszip';

parse: parseZipAsync
}; // TODO - Could return a map of promises, perhaps as an option...
};

@@ -15,21 +15,14 @@ function parseZipAsync(data, options) {

return jsZip.loadAsync(data, options).then(zip => {
// start to load each file in this zip
zip.forEach((relativePath, zipEntry) => {
const subFilename = zipEntry.name;
const promise = jsZip.file(subFilename) // jszip supports both arraybuffer and text, the main loaders.gl types
// https://stuk.github.io/jszip/documentation/api_zipobject/async.html
.async(options.dataType || 'arraybuffer').then(arrayBuffer => {
// Store file data in map
const promise = jsZip.file(subFilename).async(options.dataType || 'arraybuffer').then(arrayBuffer => {
fileMap[relativePath] = arrayBuffer;
}).catch(error => {
options.log.error(`Unable to read ${subFilename} from zip archive: ${error}`); // Store error in place of data in map
options.log.error(`Unable to read ${subFilename} from zip archive: ${error}`);
fileMap[relativePath] = error;
}); // Ensure Promise.all doesn't ignore rejected promises.
});
promises.push(promise.catch(e => e));
});
return Promise.all(promises);
}) // Return fileMap
.then(() => fileMap).catch(error => {
}).then(() => fileMap).catch(error => {
options.log.error(`Unable to read zip archive: ${error}`);

@@ -36,0 +29,0 @@ throw error;

@@ -11,12 +11,9 @@ import JSZip from 'jszip';

function encodeZipAsync(fileMap, options) {
const jsZip = new JSZip(); // add files to the zip
const jsZip = new JSZip();
for (const subFileName in fileMap) {
const subFileData = fileMap[subFileName]; // jszip supports both arraybuffer and string data (the main loaders.gl types)
// https://stuk.github.io/jszip/documentation/api_zipobject/async.html
const subFileData = fileMap[subFileName];
jsZip.file(subFileName, subFileData, options);
} // always generate the full zip as an arraybuffer
}
options = Object.assign({}, options, {

@@ -23,0 +20,0 @@ type: 'arraybuffer'

@@ -7,3 +7,3 @@ import JSZip from 'jszip';

parse: parseZipAsync
}; // TODO - Could return a map of promises, perhaps as an option...
};

@@ -15,16 +15,10 @@ function parseZipAsync(data, options) {

return jsZip.loadAsync(data, options).then(function (zip) {
// start to load each file in this zip
zip.forEach(function (relativePath, zipEntry) {
var subFilename = zipEntry.name;
var promise = jsZip.file(subFilename) // jszip supports both arraybuffer and text, the main loaders.gl types
// https://stuk.github.io/jszip/documentation/api_zipobject/async.html
.async(options.dataType || 'arraybuffer').then(function (arrayBuffer) {
// Store file data in map
var promise = jsZip.file(subFilename).async(options.dataType || 'arraybuffer').then(function (arrayBuffer) {
fileMap[relativePath] = arrayBuffer;
}).catch(function (error) {
options.log.error("Unable to read ".concat(subFilename, " from zip archive: ").concat(error)); // Store error in place of data in map
options.log.error("Unable to read ".concat(subFilename, " from zip archive: ").concat(error));
fileMap[relativePath] = error;
}); // Ensure Promise.all doesn't ignore rejected promises.
});
promises.push(promise.catch(function (e) {

@@ -35,4 +29,3 @@ return e;

return Promise.all(promises);
}) // Return fileMap
.then(function () {
}).then(function () {
return fileMap;

@@ -39,0 +32,0 @@ }).catch(function (error) {

@@ -11,12 +11,9 @@ import JSZip from 'jszip';

function encodeZipAsync(fileMap, options) {
var jsZip = new JSZip(); // add files to the zip
var jsZip = new JSZip();
for (var subFileName in fileMap) {
var subFileData = fileMap[subFileName]; // jszip supports both arraybuffer and string data (the main loaders.gl types)
// https://stuk.github.io/jszip/documentation/api_zipobject/async.html
var subFileData = fileMap[subFileName];
jsZip.file(subFileName, subFileData, options);
} // always generate the full zip as an arraybuffer
}
options = Object.assign({}, options, {

@@ -23,0 +20,0 @@ type: 'arraybuffer'

{
"name": "@loaders.gl/zip",
"version": "0.8.0",
"version": "1.0.0-alpha.1",
"description": "Zip Archive Loader",

@@ -29,14 +29,8 @@ "license": "MIT",

],
"scripts": {
"clean": "rm -fr dist && mkdir -p dist",
"build": "npm run clean && npm run build-es6 && npm run build-esm && npm run build-es5",
"build-es6": "BABEL_ENV=es6 babel src --config-file ../../babel.config.js --out-dir dist/es6 --source-maps --ignore 'node_modules/'",
"build-esm": "BABEL_ENV=esm babel src --config-file ../../babel.config.js --out-dir dist/esm --source-maps --ignore 'node_modules/'",
"build-es5": "BABEL_ENV=es5 babel src --config-file ../../babel.config.js --out-dir dist/es5 --source-maps --ignore 'node_modules/'"
},
"scripts": {},
"sideEffects": false,
"dependencies": {
"@loaders.gl/core": "^0.8.0",
"@loaders.gl/core": "1.0.0-alpha.1",
"jszip": "^3.1.5"
}
}

@@ -16,35 +16,38 @@ import JSZip from 'jszip';

const jsZip = new JSZip();
return jsZip.loadAsync(data, options).then(
zip => {
// start to load each file in this zip
zip.forEach((relativePath, zipEntry) => {
const subFilename = zipEntry.name;
return (
jsZip
.loadAsync(data, options)
.then(zip => {
// start to load each file in this zip
zip.forEach((relativePath, zipEntry) => {
const subFilename = zipEntry.name;
const promise = jsZip
.file(subFilename)
// jszip supports both arraybuffer and text, the main loaders.gl types
// https://stuk.github.io/jszip/documentation/api_zipobject/async.html
.async(options.dataType || 'arraybuffer')
.then(arrayBuffer => {
// Store file data in map
fileMap[relativePath] = arrayBuffer;
})
.catch(error => {
options.log.error(`Unable to read ${subFilename} from zip archive: ${error}`);
// Store error in place of data in map
fileMap[relativePath] = error;
});
const promise = jsZip
.file(subFilename)
// jszip supports both arraybuffer and text, the main loaders.gl types
// https://stuk.github.io/jszip/documentation/api_zipobject/async.html
.async(options.dataType || 'arraybuffer')
.then(arrayBuffer => {
// Store file data in map
fileMap[relativePath] = arrayBuffer;
})
.catch(error => {
options.log.error(`Unable to read ${subFilename} from zip archive: ${error}`);
// Store error in place of data in map
fileMap[relativePath] = error;
});
// Ensure Promise.all doesn't ignore rejected promises.
promises.push(promise.catch(e => e));
});
// Ensure Promise.all doesn't ignore rejected promises.
promises.push(promise.catch(e => e));
});
return Promise.all(promises);
})
// Return fileMap
.then(() => fileMap)
.catch(error => {
options.log.error(`Unable to read zip archive: ${error}`);
throw error;
});
return Promise.all(promises);
})
// Return fileMap
.then(() => fileMap)
.catch(error => {
options.log.error(`Unable to read zip archive: ${error}`);
throw error;
})
);
}

@@ -28,4 +28,3 @@ import JSZip from 'jszip';

return jsZip.generateAsync(options, onUpdate)
.catch(error => {
return jsZip.generateAsync(options, onUpdate).catch(error => {
options.log.error(`Unable to write zip archive: ${error}`);

@@ -35,2 +34,1 @@ throw error;

}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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