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

@loaders.gl/zip

Package Overview
Dependencies
Maintainers
9
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 4.0.0-alpha.23 to 4.0.0-alpha.24

2

dist/es5/zip-loader.js

@@ -11,3 +11,3 @@ "use strict";

var _jszip = _interopRequireDefault(require("jszip"));
var VERSION = typeof "4.0.0-alpha.23" !== 'undefined' ? "4.0.0-alpha.23" : 'latest';
var VERSION = typeof "4.0.0-alpha.24" !== 'undefined' ? "4.0.0-alpha.24" : 'latest';
var ZipLoader = {

@@ -14,0 +14,0 @@ id: 'zip',

@@ -9,4 +9,7 @@ "use strict";

var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _jszip = _interopRequireDefault(require("jszip"));
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
var ZipWriter = {

@@ -29,3 +32,3 @@ name: 'Zip Archive',

subFileData,
_options,
jszipOptions,
_options$onUpdate,

@@ -41,17 +44,23 @@ onUpdate,

subFileData = fileMap[subFileName];
jsZip.file(subFileName, subFileData, options);
jsZip.file(subFileName, subFileData, (options === null || options === void 0 ? void 0 : options.jszip) || {});
}
options = Object.assign({}, options, {
jszipOptions = _objectSpread(_objectSpread({}, options === null || options === void 0 ? void 0 : options.jszip), {}, {
type: 'arraybuffer'
});
_options = options, _options$onUpdate = _options.onUpdate, onUpdate = _options$onUpdate === void 0 ? function () {} : _options$onUpdate;
return _context.abrupt("return", jsZip.generateAsync(options, onUpdate).catch(function (error) {
options.log.error("Unable to write zip archive: ".concat(error));
throw error;
}));
case 6:
_options$onUpdate = options.onUpdate, onUpdate = _options$onUpdate === void 0 ? function () {} : _options$onUpdate;
_context.prev = 5;
_context.next = 8;
return jsZip.generateAsync(jszipOptions, onUpdate);
case 8:
return _context.abrupt("return", _context.sent);
case 11:
_context.prev = 11;
_context.t0 = _context["catch"](5);
options.log.error("Unable to write zip archive: ".concat(_context.t0));
throw _context.t0;
case 15:
case "end":
return _context.stop();
}
}, _callee);
}, _callee, null, [[5, 11]]);
}));

@@ -58,0 +67,0 @@ return _encodeZipAsync.apply(this, arguments);

import JSZip from 'jszip';
const VERSION = typeof "4.0.0-alpha.23" !== 'undefined' ? "4.0.0-alpha.23" : 'latest';
const VERSION = typeof "4.0.0-alpha.24" !== 'undefined' ? "4.0.0-alpha.24" : 'latest';
export const ZipLoader = {

@@ -4,0 +4,0 @@ id: 'zip',

@@ -14,15 +14,18 @@ import JSZip from 'jszip';

const subFileData = fileMap[subFileName];
jsZip.file(subFileName, subFileData, options);
jsZip.file(subFileName, subFileData, (options === null || options === void 0 ? void 0 : options.jszip) || {});
}
options = Object.assign({}, options, {
const jszipOptions = {
...(options === null || options === void 0 ? void 0 : options.jszip),
type: 'arraybuffer'
});
};
const {
onUpdate = () => {}
} = options;
return jsZip.generateAsync(options, onUpdate).catch(error => {
try {
return await jsZip.generateAsync(jszipOptions, onUpdate);
} catch (error) {
options.log.error("Unable to write zip archive: ".concat(error));
throw error;
});
}
}
//# sourceMappingURL=zip-writer.js.map

@@ -1,6 +0,16 @@

import type { Writer } from '@loaders.gl/loader-utils';
import type { Writer, WriterOptions } from '@loaders.gl/loader-utils';
import { JSZipGeneratorOptions } from 'jszip';
export type ZipWriterOptions = WriterOptions & {
zip?: {
onUpdate?: (metadata: {
percent: number;
}) => void;
};
/** Passthrough options to jszip */
jszip?: JSZipGeneratorOptions;
};
/**
* Zip exporter
*/
export declare const ZipWriter: Writer;
export declare const ZipWriter: Writer<FileReaderEventMap, never, ZipWriterOptions>;
//# sourceMappingURL=zip-writer.d.ts.map
{
"name": "@loaders.gl/zip",
"version": "4.0.0-alpha.23",
"version": "4.0.0-alpha.24",
"description": "Zip Archive Loader",

@@ -33,7 +33,7 @@ "license": "MIT",

"dependencies": {
"@loaders.gl/compression": "4.0.0-alpha.23",
"@loaders.gl/loader-utils": "4.0.0-alpha.23",
"@loaders.gl/compression": "4.0.0-alpha.24",
"@loaders.gl/loader-utils": "4.0.0-alpha.24",
"jszip": "^3.1.5"
},
"gitHead": "e212f2a0c0e342f7cb65ce84fa2ff39f64b7d94b"
"gitHead": "97a8990595c132fb14e3445a8768d9f4cb98ff05"
}

@@ -1,2 +0,3 @@

// Zip loader
// loaders.gl, MIT license
import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';

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

@@ -1,8 +0,18 @@

import type {Writer} from '@loaders.gl/loader-utils';
import JSZip from 'jszip';
// loaders.gl, MIT license
import type {Writer, WriterOptions} from '@loaders.gl/loader-utils';
import JSZip, {JSZipGeneratorOptions} from 'jszip';
export type ZipWriterOptions = WriterOptions & {
zip?: {
onUpdate?: (metadata: {percent: number}) => void;
};
/** Passthrough options to jszip */
jszip?: JSZipGeneratorOptions;
};
/**
* Zip exporter
*/
export const ZipWriter: Writer = {
export const ZipWriter: Writer<FileReaderEventMap, never, ZipWriterOptions> = {
name: 'Zip Archive',

@@ -16,3 +26,6 @@ extensions: ['zip'],

async function encodeZipAsync(fileMap: any, options: any = {}) {
async function encodeZipAsync(
fileMap: Record<string, ArrayBuffer>,
options: ZipWriterOptions = {}
) {
const jsZip = new JSZip();

@@ -25,15 +38,15 @@ // add files to the zip

// https://stuk.github.io/jszip/documentation/api_zipobject/async.html
jsZip.file(subFileName, subFileData, options);
jsZip.file(subFileName, subFileData, options?.jszip || {});
}
// always generate the full zip as an arraybuffer
options = Object.assign({}, options, {
type: 'arraybuffer'
});
const jszipOptions: JSZipGeneratorOptions = {...options?.jszip, type: 'arraybuffer'};
const {onUpdate = () => {}} = options;
return jsZip.generateAsync(options, onUpdate).catch((error) => {
try {
return await jsZip.generateAsync(jszipOptions, onUpdate);
} catch (error) {
options.log.error(`Unable to write zip archive: ${error}`);
throw error;
});
}
}

Sorry, the diff of this file is too big to display

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