@loaders.gl/zip
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -12,2 +12,4 @@ "use strict"; | ||
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator")); | ||
var _jszip = _interopRequireDefault(require("jszip")); | ||
@@ -28,71 +30,85 @@ | ||
function parseZipAsync(data, options) { | ||
var promises, fileMap, jsZip, zip; | ||
return _regenerator["default"].async(function parseZipAsync$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
promises = []; | ||
fileMap = {}; | ||
_context.prev = 2; | ||
jsZip = new _jszip["default"](); | ||
_context.next = 6; | ||
return _regenerator["default"].awrap(jsZip.loadAsync(data, options)); | ||
function parseZipAsync(_x, _x2) { | ||
return _parseZipAsync.apply(this, arguments); | ||
} | ||
case 6: | ||
zip = _context.sent; | ||
zip.forEach(function (relativePath, zipEntry) { | ||
var subFilename = zipEntry.name; | ||
var promise = loadZipEntry(jsZip, subFilename, options).then(function (arrayBufferOrError) { | ||
fileMap[relativePath] = arrayBufferOrError; | ||
function _parseZipAsync() { | ||
_parseZipAsync = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(data, options) { | ||
var promises, fileMap, jsZip, zip; | ||
return _regenerator["default"].wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
promises = []; | ||
fileMap = {}; | ||
_context.prev = 2; | ||
jsZip = new _jszip["default"](); | ||
_context.next = 6; | ||
return jsZip.loadAsync(data, options); | ||
case 6: | ||
zip = _context.sent; | ||
zip.forEach(function (relativePath, zipEntry) { | ||
var subFilename = zipEntry.name; | ||
var promise = loadZipEntry(jsZip, subFilename, options).then(function (arrayBufferOrError) { | ||
fileMap[relativePath] = arrayBufferOrError; | ||
}); | ||
promises.push(promise); | ||
}); | ||
promises.push(promise); | ||
}); | ||
_context.next = 10; | ||
return _regenerator["default"].awrap(Promise.all(promises)); | ||
_context.next = 10; | ||
return Promise.all(promises); | ||
case 10: | ||
return _context.abrupt("return", fileMap); | ||
case 10: | ||
return _context.abrupt("return", fileMap); | ||
case 13: | ||
_context.prev = 13; | ||
_context.t0 = _context["catch"](2); | ||
options.log.error("Unable to read zip archive: ".concat(_context.t0)); | ||
throw _context.t0; | ||
case 13: | ||
_context.prev = 13; | ||
_context.t0 = _context["catch"](2); | ||
options.log.error("Unable to read zip archive: ".concat(_context.t0)); | ||
throw _context.t0; | ||
case 17: | ||
case "end": | ||
return _context.stop(); | ||
case 17: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
} | ||
} | ||
}, null, null, [[2, 13]]); | ||
}, _callee, null, [[2, 13]]); | ||
})); | ||
return _parseZipAsync.apply(this, arguments); | ||
} | ||
function loadZipEntry(jsZip, subFilename, options) { | ||
var arrayBuffer; | ||
return _regenerator["default"].async(function loadZipEntry$(_context2) { | ||
while (1) { | ||
switch (_context2.prev = _context2.next) { | ||
case 0: | ||
_context2.prev = 0; | ||
_context2.next = 3; | ||
return _regenerator["default"].awrap(jsZip.file(subFilename).async(options.dataType || 'arraybuffer')); | ||
function loadZipEntry(_x3, _x4, _x5) { | ||
return _loadZipEntry.apply(this, arguments); | ||
} | ||
case 3: | ||
arrayBuffer = _context2.sent; | ||
return _context2.abrupt("return", arrayBuffer); | ||
function _loadZipEntry() { | ||
_loadZipEntry = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee2(jsZip, subFilename, options) { | ||
var arrayBuffer; | ||
return _regenerator["default"].wrap(function _callee2$(_context2) { | ||
while (1) { | ||
switch (_context2.prev = _context2.next) { | ||
case 0: | ||
_context2.prev = 0; | ||
_context2.next = 3; | ||
return jsZip.file(subFilename).async(options.dataType || 'arraybuffer'); | ||
case 7: | ||
_context2.prev = 7; | ||
_context2.t0 = _context2["catch"](0); | ||
options.log.error("Unable to read ".concat(subFilename, " from zip archive: ").concat(_context2.t0)); | ||
return _context2.abrupt("return", _context2.t0); | ||
case 3: | ||
arrayBuffer = _context2.sent; | ||
return _context2.abrupt("return", arrayBuffer); | ||
case 11: | ||
case "end": | ||
return _context2.stop(); | ||
case 7: | ||
_context2.prev = 7; | ||
_context2.t0 = _context2["catch"](0); | ||
options.log.error("Unable to read ".concat(subFilename, " from zip archive: ").concat(_context2.t0)); | ||
return _context2.abrupt("return", _context2.t0); | ||
case 11: | ||
case "end": | ||
return _context2.stop(); | ||
} | ||
} | ||
} | ||
}, null, null, [[0, 7]]); | ||
}, _callee2, null, [[0, 7]]); | ||
})); | ||
return _loadZipEntry.apply(this, arguments); | ||
} | ||
//# sourceMappingURL=zip-loader.js.map |
import _regeneratorRuntime from "@babel/runtime/regenerator"; | ||
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator"; | ||
import JSZip from 'jszip'; | ||
@@ -15,71 +16,85 @@ var VERSION = typeof "2.0.0" !== 'undefined' ? "2.0.0" : 'latest'; | ||
function parseZipAsync(data, options) { | ||
var promises, fileMap, jsZip, zip; | ||
return _regeneratorRuntime.async(function parseZipAsync$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
promises = []; | ||
fileMap = {}; | ||
_context.prev = 2; | ||
jsZip = new JSZip(); | ||
_context.next = 6; | ||
return _regeneratorRuntime.awrap(jsZip.loadAsync(data, options)); | ||
function parseZipAsync(_x, _x2) { | ||
return _parseZipAsync.apply(this, arguments); | ||
} | ||
case 6: | ||
zip = _context.sent; | ||
zip.forEach(function (relativePath, zipEntry) { | ||
var subFilename = zipEntry.name; | ||
var promise = loadZipEntry(jsZip, subFilename, options).then(function (arrayBufferOrError) { | ||
fileMap[relativePath] = arrayBufferOrError; | ||
function _parseZipAsync() { | ||
_parseZipAsync = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(data, options) { | ||
var promises, fileMap, jsZip, zip; | ||
return _regeneratorRuntime.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
promises = []; | ||
fileMap = {}; | ||
_context.prev = 2; | ||
jsZip = new JSZip(); | ||
_context.next = 6; | ||
return jsZip.loadAsync(data, options); | ||
case 6: | ||
zip = _context.sent; | ||
zip.forEach(function (relativePath, zipEntry) { | ||
var subFilename = zipEntry.name; | ||
var promise = loadZipEntry(jsZip, subFilename, options).then(function (arrayBufferOrError) { | ||
fileMap[relativePath] = arrayBufferOrError; | ||
}); | ||
promises.push(promise); | ||
}); | ||
promises.push(promise); | ||
}); | ||
_context.next = 10; | ||
return _regeneratorRuntime.awrap(Promise.all(promises)); | ||
_context.next = 10; | ||
return Promise.all(promises); | ||
case 10: | ||
return _context.abrupt("return", fileMap); | ||
case 10: | ||
return _context.abrupt("return", fileMap); | ||
case 13: | ||
_context.prev = 13; | ||
_context.t0 = _context["catch"](2); | ||
options.log.error("Unable to read zip archive: ".concat(_context.t0)); | ||
throw _context.t0; | ||
case 13: | ||
_context.prev = 13; | ||
_context.t0 = _context["catch"](2); | ||
options.log.error("Unable to read zip archive: ".concat(_context.t0)); | ||
throw _context.t0; | ||
case 17: | ||
case "end": | ||
return _context.stop(); | ||
case 17: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
} | ||
} | ||
}, null, null, [[2, 13]]); | ||
}, _callee, null, [[2, 13]]); | ||
})); | ||
return _parseZipAsync.apply(this, arguments); | ||
} | ||
function loadZipEntry(jsZip, subFilename, options) { | ||
var arrayBuffer; | ||
return _regeneratorRuntime.async(function loadZipEntry$(_context2) { | ||
while (1) { | ||
switch (_context2.prev = _context2.next) { | ||
case 0: | ||
_context2.prev = 0; | ||
_context2.next = 3; | ||
return _regeneratorRuntime.awrap(jsZip.file(subFilename).async(options.dataType || 'arraybuffer')); | ||
function loadZipEntry(_x3, _x4, _x5) { | ||
return _loadZipEntry.apply(this, arguments); | ||
} | ||
case 3: | ||
arrayBuffer = _context2.sent; | ||
return _context2.abrupt("return", arrayBuffer); | ||
function _loadZipEntry() { | ||
_loadZipEntry = _asyncToGenerator(_regeneratorRuntime.mark(function _callee2(jsZip, subFilename, options) { | ||
var arrayBuffer; | ||
return _regeneratorRuntime.wrap(function _callee2$(_context2) { | ||
while (1) { | ||
switch (_context2.prev = _context2.next) { | ||
case 0: | ||
_context2.prev = 0; | ||
_context2.next = 3; | ||
return jsZip.file(subFilename).async(options.dataType || 'arraybuffer'); | ||
case 7: | ||
_context2.prev = 7; | ||
_context2.t0 = _context2["catch"](0); | ||
options.log.error("Unable to read ".concat(subFilename, " from zip archive: ").concat(_context2.t0)); | ||
return _context2.abrupt("return", _context2.t0); | ||
case 3: | ||
arrayBuffer = _context2.sent; | ||
return _context2.abrupt("return", arrayBuffer); | ||
case 11: | ||
case "end": | ||
return _context2.stop(); | ||
case 7: | ||
_context2.prev = 7; | ||
_context2.t0 = _context2["catch"](0); | ||
options.log.error("Unable to read ".concat(subFilename, " from zip archive: ").concat(_context2.t0)); | ||
return _context2.abrupt("return", _context2.t0); | ||
case 11: | ||
case "end": | ||
return _context2.stop(); | ||
} | ||
} | ||
} | ||
}, null, null, [[0, 7]]); | ||
}, _callee2, null, [[0, 7]]); | ||
})); | ||
return _loadZipEntry.apply(this, arguments); | ||
} | ||
//# sourceMappingURL=zip-loader.js.map |
{ | ||
"name": "@loaders.gl/zip", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Zip Archive Loader", | ||
@@ -33,6 +33,6 @@ "license": "MIT", | ||
"dependencies": { | ||
"@loaders.gl/core": "2.0.0", | ||
"@loaders.gl/core": "2.0.1", | ||
"jszip": "^3.1.5" | ||
}, | ||
"gitHead": "addaa8e2e634bd0c9e96da200d0388f62a669666" | ||
"gitHead": "ae0763bd05bbe9b14aedf2a99e5873db16739bb7" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
794297
16518
+ Added@loaders.gl/core@2.0.1(transitive)
+ Added@loaders.gl/loader-utils@2.0.1(transitive)
- Removed@loaders.gl/core@2.0.0(transitive)
- Removed@loaders.gl/loader-utils@2.0.0(transitive)
Updated@loaders.gl/core@2.0.1