@loaders.gl/zip 3.4.0-alpha.2 → 3.4.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"sourcesContent":["export {ZipLoader} from './zip-loader';\nexport {ZipWriter} from './zip-writer';\nexport {default as TarBuilder} from './tar-builder';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA"}
1
+ {"version":3,"file":"index.js","names":["_zipLoader","require","_zipWriter","_tarBuilder","_interopRequireDefault"],"sources":["../../src/index.ts"],"sourcesContent":["export {ZipLoader} from './zip-loader';\nexport {ZipWriter} from './zip-writer';\nexport {default as TarBuilder} from './tar-builder';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA"}
@@ -10,7 +10,6 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
10
10
  var utils = _interopRequireWildcard(require("./utils"));
11
11
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
12
12
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
13
-
14
13
  var structure = {
15
14
  fileName: 100,
16
15
  fileMode: 8,
@@ -43,7 +42,6 @@ function format(data, cb) {
43
42
  buffer[offset] = str.charCodeAt(i);
44
43
  offset += 1;
45
44
  }
46
-
47
45
  offset += length - i;
48
46
  });
49
47
  if (typeof cb === 'function') {
@@ -1 +1 @@
1
- {"version":3,"file":"header.js","names":["structure","fileName","fileMode","uid","gid","fileSize","mtime","checksum","type","linkName","ustar","owner","group","majorNumber","minorNumber","filenamePrefix","padding","format","data","cb","buffer","utils","clean","offset","Object","entries","forEach","field","length","str","i","fieldLength","charCodeAt"],"sources":["../../../../src/lib/tar/header.ts"],"sourcesContent":["// This file is derived from the tar-js code base under MIT license\n// See https://github.com/beatgammit/tar-js/blob/master/LICENSE\n/*\n * tar-js\n * MIT (c) 2011 T. Jameson Little\n */\n/* eslint-disable */\nimport * as utils from './utils';\nimport type {TarStructure, TarData} from './types';\n/*\nstruct posix_header { // byte offset\n\tchar name[100]; // 0\n\tchar mode[8]; // 100\n\tchar uid[8]; // 108\n\tchar gid[8]; // 116\n\tchar size[12]; // 124\n\tchar mtime[12]; // 136\n\tchar chksum[8]; // 148\n\tchar typeflag; // 156\n\tchar linkname[100]; // 157\n\tchar magic[6]; // 257\n\tchar version[2]; // 263\n\tchar uname[32]; // 265\n\tchar gname[32]; // 297\n\tchar devmajor[8]; // 329\n\tchar devminor[8]; // 337\n\tchar prefix[155]; // 345\n // 500\n};\n*/\n\nconst structure: TarStructure = {\n fileName: 100,\n fileMode: 8,\n uid: 8,\n gid: 8,\n fileSize: 12,\n mtime: 12,\n checksum: 8,\n type: 1,\n linkName: 100,\n ustar: 8,\n owner: 32,\n group: 32,\n majorNumber: 8,\n minorNumber: 8,\n filenamePrefix: 155,\n padding: 12\n};\n/**\n * Getting the header\n * @param data\n * @param [cb]\n * @returns {Uint8Array} | Array\n */\nexport function format(data: TarData, cb?: any): [string, number][] | Uint8Array {\n const buffer = utils.clean(512);\n let offset = 0;\n\n Object.entries(structure).forEach(([field, length]) => {\n const str = data[field] || '';\n let i: number;\n let fieldLength: number;\n\n for (i = 0, fieldLength = str.length; i < fieldLength; i += 1) {\n buffer[offset] = str.charCodeAt(i);\n offset += 1;\n }\n\n // space it out with nulls\n offset += length - i;\n });\n\n if (typeof cb === 'function') {\n return cb(buffer, offset);\n }\n return buffer;\n}\n"],"mappings":";;;;;;;;;AAOA;AAAiC;AAAA;;AAwBjC,IAAMA,SAAuB,GAAG;EAC9BC,QAAQ,EAAE,GAAG;EACbC,QAAQ,EAAE,CAAC;EACXC,GAAG,EAAE,CAAC;EACNC,GAAG,EAAE,CAAC;EACNC,QAAQ,EAAE,EAAE;EACZC,KAAK,EAAE,EAAE;EACTC,QAAQ,EAAE,CAAC;EACXC,IAAI,EAAE,CAAC;EACPC,QAAQ,EAAE,GAAG;EACbC,KAAK,EAAE,CAAC;EACRC,KAAK,EAAE,EAAE;EACTC,KAAK,EAAE,EAAE;EACTC,WAAW,EAAE,CAAC;EACdC,WAAW,EAAE,CAAC;EACdC,cAAc,EAAE,GAAG;EACnBC,OAAO,EAAE;AACX,CAAC;AAOM,SAASC,MAAM,CAACC,IAAa,EAAEC,EAAQ,EAAmC;EAC/E,IAAMC,MAAM,GAAGC,KAAK,CAACC,KAAK,CAAC,GAAG,CAAC;EAC/B,IAAIC,MAAM,GAAG,CAAC;EAEdC,MAAM,CAACC,OAAO,CAACzB,SAAS,CAAC,CAAC0B,OAAO,CAAC,gBAAqB;IAAA;MAAnBC,KAAK;MAAEC,MAAM;IAC/C,IAAMC,GAAG,GAAGX,IAAI,CAACS,KAAK,CAAC,IAAI,EAAE;IAC7B,IAAIG,CAAS;IACb,IAAIC,WAAmB;IAEvB,KAAKD,CAAC,GAAG,CAAC,EAAEC,WAAW,GAAGF,GAAG,CAACD,MAAM,EAAEE,CAAC,GAAGC,WAAW,EAAED,CAAC,IAAI,CAAC,EAAE;MAC7DV,MAAM,CAACG,MAAM,CAAC,GAAGM,GAAG,CAACG,UAAU,CAACF,CAAC,CAAC;MAClCP,MAAM,IAAI,CAAC;IACb;;IAGAA,MAAM,IAAIK,MAAM,GAAGE,CAAC;EACtB,CAAC,CAAC;EAEF,IAAI,OAAOX,EAAE,KAAK,UAAU,EAAE;IAC5B,OAAOA,EAAE,CAACC,MAAM,EAAEG,MAAM,CAAC;EAC3B;EACA,OAAOH,MAAM;AACf"}
1
+ {"version":3,"file":"header.js","names":["utils","_interopRequireWildcard","require","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","structure","fileName","fileMode","uid","gid","fileSize","mtime","checksum","type","linkName","ustar","owner","group","majorNumber","minorNumber","filenamePrefix","padding","format","data","cb","buffer","clean","offset","entries","forEach","_ref","_ref2","_slicedToArray2","field","length","str","i","fieldLength","charCodeAt"],"sources":["../../../../src/lib/tar/header.ts"],"sourcesContent":["// This file is derived from the tar-js code base under MIT license\n// See https://github.com/beatgammit/tar-js/blob/master/LICENSE\n/*\n * tar-js\n * MIT (c) 2011 T. Jameson Little\n */\n/* eslint-disable */\nimport * as utils from './utils';\nimport type {TarStructure, TarData} from './types';\n/*\nstruct posix_header { // byte offset\n\tchar name[100]; // 0\n\tchar mode[8]; // 100\n\tchar uid[8]; // 108\n\tchar gid[8]; // 116\n\tchar size[12]; // 124\n\tchar mtime[12]; // 136\n\tchar chksum[8]; // 148\n\tchar typeflag; // 156\n\tchar linkname[100]; // 157\n\tchar magic[6]; // 257\n\tchar version[2]; // 263\n\tchar uname[32]; // 265\n\tchar gname[32]; // 297\n\tchar devmajor[8]; // 329\n\tchar devminor[8]; // 337\n\tchar prefix[155]; // 345\n // 500\n};\n*/\n\nconst structure: TarStructure = {\n fileName: 100,\n fileMode: 8,\n uid: 8,\n gid: 8,\n fileSize: 12,\n mtime: 12,\n checksum: 8,\n type: 1,\n linkName: 100,\n ustar: 8,\n owner: 32,\n group: 32,\n majorNumber: 8,\n minorNumber: 8,\n filenamePrefix: 155,\n padding: 12\n};\n/**\n * Getting the header\n * @param data\n * @param [cb]\n * @returns {Uint8Array} | Array\n */\nexport function format(data: TarData, cb?: any): [string, number][] | Uint8Array {\n const buffer = utils.clean(512);\n let offset = 0;\n\n Object.entries(structure).forEach(([field, length]) => {\n const str = data[field] || '';\n let i: number;\n let fieldLength: number;\n\n for (i = 0, fieldLength = str.length; i < fieldLength; i += 1) {\n buffer[offset] = str.charCodeAt(i);\n offset += 1;\n }\n\n // space it out with nulls\n offset += length - i;\n });\n\n if (typeof cb === 'function') {\n return cb(buffer, offset);\n }\n return buffer;\n}\n"],"mappings":";;;;;;;;;AAOA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAiC,SAAAC,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAH,wBAAAO,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,aAAAE,OAAA,CAAAF,GAAA,yBAAAA,GAAA,4BAAAG,OAAA,EAAAH,GAAA,UAAAI,KAAA,GAAAT,wBAAA,CAAAC,WAAA,OAAAQ,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAL,GAAA,YAAAI,KAAA,CAAAE,GAAA,CAAAN,GAAA,SAAAO,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA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wC,IAAA;MAAnBG,KAAK,GAAAF,KAAA;MAAEG,MAAM,GAAAH,KAAA;IAC/C,IAAMI,GAAG,GAAGZ,IAAI,CAACU,KAAK,CAAC,IAAI,EAAE;IAC7B,IAAIG,CAAS;IACb,IAAIC,WAAmB;IAEvB,KAAKD,CAAC,GAAG,CAAC,EAAEC,WAAW,GAAGF,GAAG,CAACD,MAAM,EAAEE,CAAC,GAAGC,WAAW,EAAED,CAAC,IAAI,CAAC,EAAE;MAC7DX,MAAM,CAACE,MAAM,CAAC,GAAGQ,GAAG,CAACG,UAAU,CAACF,CAAC,CAAC;MAClCT,MAAM,IAAI,CAAC;IACb;IAGAA,MAAM,IAAIO,MAAM,GAAGE,CAAC;EACtB,CAAC,CAAC;EAEF,IAAI,OAAOZ,EAAE,KAAK,UAAU,EAAE;IAC5B,OAAOA,EAAE,CAACC,MAAM,EAAEE,MAAM,CAAC;EAC3B;EACA,OAAOF,MAAM;AACf"}
@@ -10,7 +10,6 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
  var _utils = require("./utils");
12
12
  var _header = require("./header");
13
-
14
13
  var blockSize;
15
14
  var headerLength;
16
15
  var inputLength;
@@ -31,11 +30,9 @@ var Tar = function () {
31
30
  this.clear = this.clear.bind(this);
32
31
  this.append = this.append.bind(this);
33
32
  }
34
-
35
33
  (0, _createClass2.default)(Tar, [{
36
34
  key: "append",
37
- value:
38
- function append(filepath, input, opts) {
35
+ value: function append(filepath, input, opts) {
39
36
  var checksum;
40
37
  if (typeof input === 'string') {
41
38
  input = (0, _utils.stringToUint8)(input);
@@ -63,7 +60,6 @@ var Tar = function () {
63
60
  owner: opts.owner || '',
64
61
  group: opts.group || ''
65
62
  };
66
-
67
63
  checksum = 0;
68
64
  Object.keys(data).forEach(function (key) {
69
65
  var i;
@@ -86,8 +82,7 @@ var Tar = function () {
86
82
  }
87
83
  }, {
88
84
  key: "save",
89
- value:
90
- function save() {
85
+ value: function save() {
91
86
  var buffers = [];
92
87
  var chunks = new Array();
93
88
  var length = 0;
@@ -130,8 +125,7 @@ var Tar = function () {
130
125
  }
131
126
  }, {
132
127
  key: "clear",
133
- value:
134
- function clear() {
128
+ value: function clear() {
135
129
  this.written = 0;
136
130
  this.out = (0, _utils.clean)(blockSize);
137
131
  }
@@ -1 +1 @@
1
- {"version":3,"file":"tar.js","names":["blockSize","headerLength","inputLength","recordSize","Tar","recordsPerBlock","written","out","clean","blocks","length","save","bind","clear","append","filepath","input","opts","checksum","stringToUint8","constructor","Uint8Array","prototype","errorInputMatch","exec","toString","errorInput","errorMessage","mode","parseInt","mtime","Math","floor","Number","Date","uid","gid","data","fileName","fileMode","pad","fileSize","type","ustar","owner","group","Object","keys","forEach","key","i","value","charCodeAt","headerArr","format","ceil","push","header","buffers","chunks","Array","max","pow","chunk","b","c","buffer","set","Blob"],"sources":["../../../../src/lib/tar/tar.ts"],"sourcesContent":["// This file is derived from the tar-js code base under MIT license\n// See https://github.com/beatgammit/tar-js/blob/master/LICENSE\n/*\n * tar-js\n * MIT (c) 2011 T. Jameson Little\n */\n\nimport {clean, pad, stringToUint8} from './utils';\nimport {format} from './header';\nimport type {TarBlocks, TarOptions, TarChunks, TarChunk} from './types';\n\nlet blockSize: number;\nlet headerLength: number;\nlet inputLength: number;\n\nconst recordSize = 512;\n\nclass Tar {\n written: number;\n out: Uint8Array;\n blocks: TarBlocks = [];\n length: number;\n\n /**\n * @param [recordsPerBlock]\n */\n constructor(recordsPerBlock: number | undefined) {\n this.written = 0;\n blockSize = (recordsPerBlock || 20) * recordSize;\n this.out = clean(blockSize);\n\n this.blocks = [];\n this.length = 0;\n this.save = this.save.bind(this);\n this.clear = this.clear.bind(this);\n this.append = this.append.bind(this);\n }\n\n /**\n * Append a file to the tar archive\n * @param filepath\n * @param input\n * @param [opts]\n */\n // eslint-disable-next-line complexity\n append(filepath: string, input: string | Uint8Array, opts?: TarOptions | undefined) {\n let checksum: string | any;\n\n if (typeof input === 'string') {\n input = stringToUint8(input);\n } else if (input.constructor && input.constructor !== Uint8Array.prototype.constructor) {\n // @ts-ignore\n const errorInputMatch = /function\\s*([$A-Za-z_][0-9A-Za-z_]*)\\s*\\(/.exec(\n input.constructor.toString()\n );\n const errorInput = errorInputMatch && errorInputMatch[1];\n const errorMessage = `Invalid input type. You gave me: ${errorInput}`;\n throw errorMessage;\n }\n\n opts = opts || {};\n\n const mode = opts.mode || parseInt('777', 8) & 0xfff;\n const mtime = opts.mtime || Math.floor(Number(new Date()) / 1000);\n const uid = opts.uid || 0;\n const gid = opts.gid || 0;\n\n const data: Record<string, string> = {\n fileName: filepath,\n fileMode: pad(mode, 7),\n uid: pad(uid, 7),\n gid: pad(gid, 7),\n fileSize: pad(input.length, 11),\n mtime: pad(mtime, 11),\n checksum: ' ',\n // 0 = just a file\n type: '0',\n ustar: 'ustar ',\n owner: opts.owner || '',\n group: opts.group || ''\n };\n\n // calculate the checksum\n checksum = 0;\n Object.keys(data).forEach((key) => {\n let i: number;\n const value = data[key];\n let length: number;\n\n for (i = 0, length = value.length; i < length; i += 1) {\n checksum += value.charCodeAt(i);\n }\n });\n\n data.checksum = `${pad(checksum, 6)}\\u0000 `;\n\n const headerArr = format(data);\n\n headerLength = Math.ceil(headerArr.length / recordSize) * recordSize;\n inputLength = Math.ceil(input.length / recordSize) * recordSize;\n\n this.blocks.push({\n header: headerArr,\n input,\n headerLength,\n inputLength\n });\n }\n /**\n * Compiling data to a Blob object\n * @returns {Blob}\n */\n save(): Blob {\n const buffers: any = [];\n const chunks = new Array<TarChunks>();\n let length = 0;\n const max = Math.pow(2, 20);\n\n let chunk = new Array<TarChunk>();\n this.blocks.forEach((b: any = []) => {\n if (length + b.headerLength + b.inputLength > max) {\n chunks.push({blocks: chunk, length});\n chunk = [];\n length = 0;\n }\n chunk.push(b);\n length += b.headerLength + b.inputLength;\n });\n chunks.push({blocks: chunk, length});\n\n chunks.forEach((c: any = []) => {\n const buffer = new Uint8Array(c.length);\n let written = 0;\n c.blocks.forEach((b: any = []) => {\n buffer.set(b.header, written);\n written += b.headerLength;\n buffer.set(b.input, written);\n written += b.inputLength;\n });\n buffers.push(buffer);\n });\n\n buffers.push(new Uint8Array(2 * recordSize));\n\n return new Blob(buffers, {type: 'octet/stream'});\n }\n /**\n * Clear the data by its blocksize\n */\n clear() {\n this.written = 0;\n this.out = clean(blockSize);\n }\n}\n\nexport default Tar;\n"],"mappings":";;;;;;;;;;AAOA;AACA;;AAGA,IAAIA,SAAiB;AACrB,IAAIC,YAAoB;AACxB,IAAIC,WAAmB;AAEvB,IAAMC,UAAU,GAAG,GAAG;AAAC,IAEjBC,GAAG;EASP,aAAYC,eAAmC,EAAE;IAAA;IAAA;IAAA;IAAA,8CAN7B,EAAE;IAAA;IAOpB,IAAI,CAACC,OAAO,GAAG,CAAC;IAChBN,SAAS,GAAG,CAACK,eAAe,IAAI,EAAE,IAAIF,UAAU;IAChD,IAAI,CAACI,GAAG,GAAG,IAAAC,YAAK,EAACR,SAAS,CAAC;IAE3B,IAAI,CAACS,MAAM,GAAG,EAAE;IAChB,IAAI,CAACC,MAAM,GAAG,CAAC;IACf,IAAI,CAACC,IAAI,GAAG,IAAI,CAACA,IAAI,CAACC,IAAI,CAAC,IAAI,CAAC;IAChC,IAAI,CAACC,KAAK,GAAG,IAAI,CAACA,KAAK,CAACD,IAAI,CAAC,IAAI,CAAC;IAClC,IAAI,CAACE,MAAM,GAAG,IAAI,CAACA,MAAM,CAACF,IAAI,CAAC,IAAI,CAAC;EACtC;;EAAC;IAAA;IAAA;IASD,gBAAOG,QAAgB,EAAEC,KAA0B,EAAEC,IAA6B,EAAE;MAClF,IAAIC,QAAsB;MAE1B,IAAI,OAAOF,KAAK,KAAK,QAAQ,EAAE;QAC7BA,KAAK,GAAG,IAAAG,oBAAa,EAACH,KAAK,CAAC;MAC9B,CAAC,MAAM,IAAIA,KAAK,CAACI,WAAW,IAAIJ,KAAK,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,OAAO,IAAIiE,IAAI,CAACV,OAAO,EAAE;QAAChB,IAAI,EAAE;MAAc,CAAC,CAAC;IAClD;EAAC;IAAA;IAAA;IAID,iBAAQ;MACN,IAAI,CAACpC,OAAO,GAAG,CAAC;MAChB,IAAI,CAACC,GAAG,GAAG,IAAAC,YAAK,EAACR,SAAS,CAAC;IAC7B;EAAC;EAAA;AAAA;AAAA,eAGYI,GAAG;AAAA"}
1
+ {"version":3,"file":"tar.js","names":["_utils","require","_header","blockSize","headerLength","inputLength","recordSize","Tar","recordsPerBlock","_classCallCheck2","default","_defineProperty2","written","out","clean","blocks","length","save","bind","clear","append","_createClass2","key","value","filepath","input","opts","checksum","stringToUint8","constructor","Uint8Array","prototype","errorInputMatch","exec","toString","errorInput","errorMessage","concat","mode","parseInt","mtime","Math","floor","Number","Date","uid","gid","data","fileName","fileMode","pad","fileSize","type","ustar","owner","group","Object","keys","forEach","i","charCodeAt","headerArr","format","ceil","push","header","buffers","chunks","Array","max","pow","chunk","b","arguments","undefined","c","buffer","set","Blob","_default","exports"],"sources":["../../../../src/lib/tar/tar.ts"],"sourcesContent":["// This file is derived from the tar-js code base under MIT license\n// See https://github.com/beatgammit/tar-js/blob/master/LICENSE\n/*\n * tar-js\n * MIT (c) 2011 T. Jameson Little\n */\n\nimport {clean, pad, stringToUint8} from './utils';\nimport {format} from './header';\nimport type {TarBlocks, TarOptions, TarChunks, TarChunk} from './types';\n\nlet blockSize: number;\nlet headerLength: number;\nlet inputLength: number;\n\nconst recordSize = 512;\n\nclass Tar {\n written: number;\n out: Uint8Array;\n blocks: TarBlocks = [];\n length: number;\n\n /**\n * @param [recordsPerBlock]\n */\n constructor(recordsPerBlock: number | undefined) {\n this.written = 0;\n blockSize = (recordsPerBlock || 20) * recordSize;\n this.out = clean(blockSize);\n\n this.blocks = [];\n this.length = 0;\n this.save = this.save.bind(this);\n this.clear = this.clear.bind(this);\n this.append = this.append.bind(this);\n }\n\n /**\n * Append a file to the tar archive\n * @param filepath\n * @param input\n * @param [opts]\n */\n // eslint-disable-next-line complexity\n append(filepath: string, input: string | Uint8Array, opts?: TarOptions | undefined) {\n let checksum: string | any;\n\n if (typeof input === 'string') {\n input = stringToUint8(input);\n } else if (input.constructor && input.constructor !== Uint8Array.prototype.constructor) {\n // @ts-ignore\n const errorInputMatch = /function\\s*([$A-Za-z_][0-9A-Za-z_]*)\\s*\\(/.exec(\n input.constructor.toString()\n );\n const errorInput = errorInputMatch && errorInputMatch[1];\n const errorMessage = `Invalid input type. You gave me: ${errorInput}`;\n throw errorMessage;\n }\n\n opts = opts || {};\n\n const mode = opts.mode || parseInt('777', 8) & 0xfff;\n const mtime = opts.mtime || Math.floor(Number(new Date()) / 1000);\n const uid = opts.uid || 0;\n const gid = opts.gid || 0;\n\n const data: Record<string, string> = {\n fileName: filepath,\n fileMode: pad(mode, 7),\n uid: pad(uid, 7),\n gid: pad(gid, 7),\n fileSize: pad(input.length, 11),\n mtime: pad(mtime, 11),\n checksum: ' ',\n // 0 = just a file\n type: '0',\n ustar: 'ustar ',\n owner: opts.owner || '',\n group: opts.group || ''\n };\n\n // calculate the checksum\n checksum = 0;\n Object.keys(data).forEach((key) => {\n let i: number;\n const value = data[key];\n let length: number;\n\n for (i = 0, length = value.length; i < length; i += 1) {\n checksum += value.charCodeAt(i);\n }\n });\n\n data.checksum = `${pad(checksum, 6)}\\u0000 `;\n\n const headerArr = format(data);\n\n headerLength = Math.ceil(headerArr.length / recordSize) * recordSize;\n inputLength = Math.ceil(input.length / recordSize) * recordSize;\n\n this.blocks.push({\n header: headerArr,\n input,\n headerLength,\n inputLength\n });\n }\n /**\n * Compiling data to a Blob object\n * @returns {Blob}\n */\n save(): Blob {\n const buffers: any = [];\n const chunks = new Array<TarChunks>();\n let length = 0;\n const max = Math.pow(2, 20);\n\n let chunk = new Array<TarChunk>();\n this.blocks.forEach((b: any = []) => {\n if (length + b.headerLength + b.inputLength > max) {\n chunks.push({blocks: chunk, length});\n chunk = [];\n length = 0;\n }\n chunk.push(b);\n length += b.headerLength + b.inputLength;\n });\n chunks.push({blocks: chunk, length});\n\n chunks.forEach((c: any = []) => {\n const buffer = new Uint8Array(c.length);\n let written = 0;\n c.blocks.forEach((b: any = []) => {\n buffer.set(b.header, written);\n written += b.headerLength;\n buffer.set(b.input, written);\n written += b.inputLength;\n });\n buffers.push(buffer);\n });\n\n buffers.push(new Uint8Array(2 * recordSize));\n\n return new Blob(buffers, {type: 'octet/stream'});\n }\n /**\n * Clear the data by its blocksize\n */\n clear() {\n this.written = 0;\n this.out = clean(blockSize);\n }\n}\n\nexport default Tar;\n"],"mappings":";;;;;;;;;;AAOA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAGA,IAAIE,SAAiB;AACrB,IAAIC,YAAoB;AACxB,IAAIC,WAAmB;AAEvB,IAAMC,UAAU,GAAG,GAAG;AAAC,IAEjBC,GAAG;EASP,SAAAA,IAAYC,eAAmC,EAAE;IAAA,IAAAC,gBAAA,CAAAC,OAAA,QAAAH,GAAA;IAAA,IAAAI,gBAAA,CAAAD,OAAA;IAAA,IAAAC,gBAAA,CAAAD,OAAA;IAAA,IAAAC,gBAAA,CAAAD,OAAA,kBAN7B,EAAE;IAAA,IAAAC,gBAAA,CAAAD,OAAA;IAOpB,IAAI,CAACE,OAAO,GAAG,CAAC;IAChBT,SAAS,GAAG,CAACK,eAAe,IAAI,EAAE,IAAIF,UAAU;IAChD,IAAI,CAACO,GAAG,GAAG,IAAAC,YAAK,EAACX,SAAS,CAAC;IAE3B,IAAI,CAACY,MAAM,GAAG,EAAE;IAChB,IAAI,CAACC,MAAM,GAAG,CAAC;IACf,IAAI,CAACC,IAAI,GAAG,IAAI,CAACA,IAAI,CAACC,IAAI,CAAC,IAAI,CAAC;IAChC,IAAI,CAACC,KAAK,GAAG,IAAI,CAACA,KAAK,CAACD,IAAI,CAAC,IAAI,CAAC;IAClC,IAAI,CAACE,MAAM,GAAG,IAAI,CAACA,MAAM,CAACF,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AC6C,CAAC,CAAC3D,MAAM,CAAC;QACvC,IAAIJ,OAAO,GAAG,CAAC;QACf+D,CAAC,CAAC5D,MAAM,CAAC2C,OAAO,CAAC,YAAiB;UAAA,IAAhBc,CAAM,GAAAC,SAAA,CAAAzD,MAAA,QAAAyD,SAAA,QAAAC,SAAA,GAAAD,SAAA,MAAG,EAAE;UAC3BG,MAAM,CAACC,GAAG,CAACL,CAAC,CAACP,MAAM,EAAErD,OAAO,CAAC;UAC7BA,OAAO,IAAI4D,CAAC,CAACpE,YAAY;UACzBwE,MAAM,CAACC,GAAG,CAACL,CAAC,CAAC/C,KAAK,EAAEb,OAAO,CAAC;UAC5BA,OAAO,IAAI4D,CAAC,CAACnE,WAAW;QAC1B,CAAC,CAAC;QACF6D,OAAO,CAACF,IAAI,CAACY,MAAM,CAAC;MACtB,CAAC,CAAC;MAEFV,OAAO,CAACF,IAAI,CAAC,IAAIlC,UAAU,CAAC,CAAC,GAAGxB,UAAU,CAAC,CAAC;MAE5C,OAAO,IAAIwE,IAAI,CAACZ,OAAO,EAAE;QAACd,IAAI,EAAE;MAAc,CAAC,CAAC;IAClD;EAAC;IAAA9B,GAAA;IAAAC,KAAA,EAID,SAAAJ,MAAA,EAAQ;MACN,IAAI,CAACP,OAAO,GAAG,CAAC;MAChB,IAAI,CAACC,GAAG,GAAG,IAAAC,YAAK,EAACX,SAAS,CAAC;IAC7B;EAAC;EAAA,OAAAI,GAAA;AAAA;AAAA,IAAAwE,QAAA,GAGYxE,GAAG;AAAAyE,OAAA,CAAAtE,OAAA,GAAAqE,QAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","names":["clean","length","i","buffer","Uint8Array","pad","num","bytes","base","numStr","toString","substr","stringToUint8","input","out","offset","charCodeAt"],"sources":["../../../../src/lib/tar/utils.ts"],"sourcesContent":["// This file is derived from the tar-js code base under MIT license\n// See https://github.com/beatgammit/tar-js/blob/master/LICENSE\n/*\n * tar-js\n * MIT (c) 2011 T. Jameson Little\n */\n/**\n * Returns the memory area specified by length\n * @param length\n * @returns {Uint8Array}\n */\nexport function clean(length: number): Uint8Array {\n let i: number;\n const buffer = new Uint8Array(length);\n for (i = 0; i < length; i += 1) {\n buffer[i] = 0;\n }\n return buffer;\n}\n/**\n * Converting data to a string\n * @param num\n * @param bytes\n * @param base\n * @returns string\n */\nexport function pad(num: number, bytes: number, base?: number): string {\n const numStr = num.toString(base || 8);\n return '000000000000'.substr(numStr.length + 12 - bytes) + numStr;\n}\n/**\n * Converting input to binary data\n * @param input\n * @param out\n * @param offset\n * @returns {Uint8Array}\n */\nexport function stringToUint8(input: string, out?: Uint8Array, offset?: number): Uint8Array {\n let i: number;\n let length: number;\n\n out = out || clean(input.length);\n\n offset = offset || 0;\n for (i = 0, length = input.length; i < length; i += 1) {\n out[offset] = input.charCodeAt(i);\n offset += 1;\n }\n\n return out;\n}\n"],"mappings":";;;;;;;;AAWO,SAASA,KAAK,CAACC,MAAc,EAAc;EAChD,IAAIC,CAAS;EACb,IAAMC,MAAM,GAAG,IAAIC,UAAU,CAACH,MAAM,CAAC;EACrC,KAAKC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGD,MAAM,EAAEC,CAAC,IAAI,CAAC,EAAE;IAC9BC,MAAM,CAACD,CAAC,CAAC,GAAG,CAAC;EACf;EACA,OAAOC,MAAM;AACf;AAQO,SAASE,GAAG,CAACC,GAAW,EAAEC,KAAa,EAAEC,IAAa,EAAU;EACrE,IAAMC,MAAM,GAAGH,GAAG,CAACI,QAAQ,CAACF,IAAI,IAAI,CAAC,CAAC;EACtC,OAAO,cAAc,CAACG,MAAM,CAACF,MAAM,CAACR,MAAM,GAAG,EAAE,GAAGM,KAAK,CAAC,GAAGE,MAAM;AACnE;AAQO,SAASG,aAAa,CAACC,KAAa,EAAEC,GAAgB,EAAEC,MAAe,EAAc;EAC1F,IAAIb,CAAS;EACb,IAAID,MAAc;EAElBa,GAAG,GAAGA,GAAG,IAAId,KAAK,CAACa,KAAK,CAACZ,MAAM,CAAC;EAEhCc,MAAM,GAAGA,MAAM,IAAI,CAAC;EACpB,KAAKb,CAAC,GAAG,CAAC,EAAED,MAAM,GAAGY,KAAK,CAACZ,MAAM,EAAEC,CAAC,GAAGD,MAAM,EAAEC,CAAC,IAAI,CAAC,EAAE;IACrDY,GAAG,CAACC,MAAM,CAAC,GAAGF,KAAK,CAACG,UAAU,CAACd,CAAC,CAAC;IACjCa,MAAM,IAAI,CAAC;EACb;EAEA,OAAOD,GAAG;AACZ"}
1
+ {"version":3,"file":"utils.js","names":["clean","length","i","buffer","Uint8Array","pad","num","bytes","base","numStr","toString","substr","stringToUint8","input","out","offset","charCodeAt"],"sources":["../../../../src/lib/tar/utils.ts"],"sourcesContent":["// This file is derived from the tar-js code base under MIT license\n// See https://github.com/beatgammit/tar-js/blob/master/LICENSE\n/*\n * tar-js\n * MIT (c) 2011 T. Jameson Little\n */\n/**\n * Returns the memory area specified by length\n * @param length\n * @returns {Uint8Array}\n */\nexport function clean(length: number): Uint8Array {\n let i: number;\n const buffer = new Uint8Array(length);\n for (i = 0; i < length; i += 1) {\n buffer[i] = 0;\n }\n return buffer;\n}\n/**\n * Converting data to a string\n * @param num\n * @param bytes\n * @param base\n * @returns string\n */\nexport function pad(num: number, bytes: number, base?: number): string {\n const numStr = num.toString(base || 8);\n return '000000000000'.substr(numStr.length + 12 - bytes) + numStr;\n}\n/**\n * Converting input to binary data\n * @param input\n * @param out\n * @param offset\n * @returns {Uint8Array}\n */\nexport function stringToUint8(input: string, out?: Uint8Array, offset?: number): Uint8Array {\n let i: number;\n let length: number;\n\n out = out || clean(input.length);\n\n offset = offset || 0;\n for (i = 0, length = input.length; i < length; i += 1) {\n out[offset] = input.charCodeAt(i);\n offset += 1;\n }\n\n return out;\n}\n"],"mappings":";;;;;;;;AAWO,SAASA,KAAKA,CAACC,MAAc,EAAc;EAChD,IAAIC,CAAS;EACb,IAAMC,MAAM,GAAG,IAAIC,UAAU,CAACH,MAAM,CAAC;EACrC,KAAKC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGD,MAAM,EAAEC,CAAC,IAAI,CAAC,EAAE;IAC9BC,MAAM,CAACD,CAAC,CAAC,GAAG,CAAC;EACf;EACA,OAAOC,MAAM;AACf;AAQO,SAASE,GAAGA,CAACC,GAAW,EAAEC,KAAa,EAAEC,IAAa,EAAU;EACrE,IAAMC,MAAM,GAAGH,GAAG,CAACI,QAAQ,CAACF,IAAI,IAAI,CAAC,CAAC;EACtC,OAAO,cAAc,CAACG,MAAM,CAACF,MAAM,CAACR,MAAM,GAAG,EAAE,GAAGM,KAAK,CAAC,GAAGE,MAAM;AACnE;AAQO,SAASG,aAAaA,CAACC,KAAa,EAAEC,GAAgB,EAAEC,MAAe,EAAc;EAC1F,IAAIb,CAAS;EACb,IAAID,MAAc;EAElBa,GAAG,GAAGA,GAAG,IAAId,KAAK,CAACa,KAAK,CAACZ,MAAM,CAAC;EAEhCc,MAAM,GAAGA,MAAM,IAAI,CAAC;EACpB,KAAKb,CAAC,GAAG,CAAC,EAAED,MAAM,GAAGY,KAAK,CAACZ,MAAM,EAAEC,CAAC,GAAGD,MAAM,EAAEC,CAAC,IAAI,CAAC,EAAE;IACrDY,GAAG,CAACC,MAAM,CAAC,GAAGF,KAAK,CAACG,UAAU,CAACd,CAAC,CAAC;IACjCa,MAAM,IAAI,CAAC;EACb;EAEA,OAAOD,GAAG;AACZ"}
@@ -27,8 +27,7 @@ var TARBuilder = function () {
27
27
  }
28
28
  (0, _createClass2.default)(TARBuilder, [{
29
29
  key: "addFile",
30
- value:
31
- function addFile(filename, buffer) {
30
+ value: function addFile(filename, buffer) {
32
31
  this.tape.append(filename, new Uint8Array(buffer));
33
32
  this.count++;
34
33
  }
@@ -37,14 +36,12 @@ var TARBuilder = function () {
37
36
  value: function () {
38
37
  var _build = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee() {
39
38
  return _regenerator.default.wrap(function _callee$(_context) {
40
- while (1) {
41
- switch (_context.prev = _context.next) {
42
- case 0:
43
- return _context.abrupt("return", new Response(this.tape.save()).arrayBuffer());
44
- case 1:
45
- case "end":
46
- return _context.stop();
47
- }
39
+ while (1) switch (_context.prev = _context.next) {
40
+ case 0:
41
+ return _context.abrupt("return", new Response(this.tape.save()).arrayBuffer());
42
+ case 1:
43
+ case "end":
44
+ return _context.stop();
48
45
  }
49
46
  }, _callee, this);
50
47
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"tar-builder.js","names":["TAR_BUILDER_OPTIONS","recordsPerBlock","TARBuilder","options","tape","Tar","filename","buffer","append","Uint8Array","count","Response","save","arrayBuffer","id","name","extensions","mimeTypes","builder"],"sources":["../../src/tar-builder.ts"],"sourcesContent":["import Tar from './lib/tar/tar';\n\nconst TAR_BUILDER_OPTIONS = {\n recordsPerBlock: 20\n};\n\ntype TarBuilderOptions = {\n recordsPerBlock?: number;\n};\n\n/**\n * Build a tar file by adding files\n */\nexport default class TARBuilder {\n static get properties() {\n return {\n id: 'tar',\n name: 'TAR',\n extensions: ['tar'],\n mimeTypes: ['application/x-tar'],\n builder: TARBuilder,\n options: TAR_BUILDER_OPTIONS\n };\n }\n\n options: TarBuilderOptions;\n tape: Tar;\n count: number = 0;\n\n constructor(options?: Partial<TarBuilderOptions>) {\n this.options = {...TAR_BUILDER_OPTIONS, ...options};\n this.tape = new Tar(this.options.recordsPerBlock);\n }\n /** Adds a file to the archive. */\n addFile(filename: string, buffer: ArrayBuffer) {\n this.tape.append(filename, new Uint8Array(buffer));\n this.count++;\n }\n\n async build(): Promise<ArrayBuffer> {\n return new Response(this.tape.save()).arrayBuffer();\n }\n}\n"],"mappings":";;;;;;;;;;;;AAAA;AAAgC;AAAA;AAEhC,IAAMA,mBAAmB,GAAG;EAC1BC,eAAe,EAAE;AACnB,CAAC;AAAC,IASmBC,UAAU;EAgB7B,oBAAYC,OAAoC,EAAE;IAAA;IAAA;IAAA;IAAA,6CAFlC,CAAC;IAGf,IAAI,CAACA,OAAO,mCAAOH,mBAAmB,GAAKG,OAAO,CAAC;IACnD,IAAI,CAACC,IAAI,GAAG,IAAIC,YAAG,CAAC,IAAI,CAACF,OAAO,CAACF,eAAe,CAAC;EACnD;EAAC;IAAA;IAAA;IAED,iBAAQK,QAAgB,EAAEC,MAAmB,EAAE;MAC7C,IAAI,CAACH,IAAI,CAACI,MAAM,CAACF,QAAQ,EAAE,IAAIG,UAAU,CAACF,MAAM,CAAC,CAAC;MAClD,IAAI,CAACG,KAAK,EAAE;IACd;EAAC;IAAA;IAAA;MAAA,uEAED;QAAA;UAAA;YAAA;cAAA;gBAAA,iCACS,IAAIC,QAAQ,CAAC,IAAI,CAACP,IAAI,CAACQ,IAAI,EAAE,CAAC,CAACC,WAAW,EAAE;cAAA;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA,CACpD;MAAA;QAAA;MAAA;MAAA;IAAA;EAAA;IAAA;IAAA,KA3BD,eAAwB;MACtB,OAAO;QACLC,EAAE,EAAE,KAAK;QACTC,IAAI,EAAE,KAAK;QACXC,UAAU,EAAE,CAAC,KAAK,CAAC;QACnBC,SAAS,EAAE,CAAC,mBAAmB,CAAC;QAChCC,OAAO,EAAEhB,UAAU;QACnBC,OAAO,EAAEH;MACX,CAAC;IACH;EAAC;EAAA;AAAA;AAAA"}
1
+ {"version":3,"file":"tar-builder.js","names":["_tar","_interopRequireDefault","require","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","TAR_BUILDER_OPTIONS","recordsPerBlock","TARBuilder","options","_classCallCheck2","tape","Tar","_createClass2","value","addFile","filename","buffer","append","Uint8Array","count","_build","_asyncToGenerator2","_regenerator","mark","_callee","wrap","_callee$","_context","prev","next","abrupt","Response","save","arrayBuffer","stop","build","get","id","name","extensions","mimeTypes","builder","exports"],"sources":["../../src/tar-builder.ts"],"sourcesContent":["import Tar from './lib/tar/tar';\n\nconst TAR_BUILDER_OPTIONS = {\n recordsPerBlock: 20\n};\n\ntype TarBuilderOptions = {\n recordsPerBlock?: number;\n};\n\n/**\n * Build a tar file by adding files\n */\nexport default class TARBuilder {\n static get properties() {\n return {\n id: 'tar',\n name: 'TAR',\n extensions: ['tar'],\n mimeTypes: ['application/x-tar'],\n builder: TARBuilder,\n options: TAR_BUILDER_OPTIONS\n };\n }\n\n options: TarBuilderOptions;\n tape: Tar;\n count: number = 0;\n\n constructor(options?: Partial<TarBuilderOptions>) {\n this.options = {...TAR_BUILDER_OPTIONS, ...options};\n this.tape = new Tar(this.options.recordsPerBlock);\n }\n /** Adds a file to the archive. */\n addFile(filename: string, buffer: ArrayBuffer) {\n this.tape.append(filename, new Uint8Array(buffer));\n this.count++;\n }\n\n async build(): Promise<ArrayBuffer> {\n return new Response(this.tape.save()).arrayBuffer();\n }\n}\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,IAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAgC,SAAAC,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,IAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,IAAA,EAAAG,OAAA,YAAAH,IAAA;AAAA,SAAAU,cAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,WAAAF,SAAA,CAAAD,CAAA,IAAAC,SAAA,CAAAD,CAAA,QAAAA,CAAA,OAAAf,OAAA,CAAAI,MAAA,CAAAc,MAAA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AsB,IAAA,CAED,SAAAC,QAAA;QAAA,OAAAF,YAAA,CAAArB,OAAA,CAAAwB,IAAA,UAAAC,SAAAC,QAAA;UAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;YAAA;cAAA,OAAAF,QAAA,CAAAG,MAAA,WACS,IAAIC,QAAQ,CAAC,IAAI,CAACrB,IAAI,CAACsB,IAAI,CAAC,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC;YAAA;YAAA;cAAA,OAAAN,QAAA,CAAAO,IAAA;UAAA;QAAA,GAAAV,OAAA;MAAA,CACpD;MAAA,SAAAW,MAAA;QAAA,OAAAf,MAAA,CAAA7B,KAAA,OAAAI,SAAA;MAAA;MAAA,OAAAwC,KAAA;IAAA;EAAA;IAAApC,GAAA;IAAAqC,GAAA,EA3BD,SAAAA,IAAA,EAAwB;MACtB,OAAO;QACLC,EAAE,EAAE,KAAK;QACTC,IAAI,EAAE,KAAK;QACXC,UAAU,EAAE,CAAC,KAAK,CAAC;QACnBC,SAAS,EAAE,CAAC,mBAAmB,CAAC;QAChCC,OAAO,EAAElC,UAAU;QACnBC,OAAO,EAAEH;MACX,CAAC;IACH;EAAC;EAAA,OAAAE,UAAA;AAAA;AAAAmC,OAAA,CAAAzC,OAAA,GAAAM,UAAA"}
@@ -8,8 +8,7 @@ exports._typecheckZipLoader = exports.ZipLoader = void 0;
8
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
10
  var _jszip = _interopRequireDefault(require("jszip"));
11
-
12
- var VERSION = typeof "3.4.0-alpha.2" !== 'undefined' ? "3.4.0-alpha.2" : 'latest';
11
+ var VERSION = typeof "3.4.0-alpha.4" !== 'undefined' ? "3.4.0-alpha.4" : 'latest';
13
12
  var ZipLoader = {
14
13
  id: 'zip',
15
14
  module: 'zip',
@@ -35,39 +34,36 @@ function _parseZipAsync() {
35
34
  zip,
36
35
  _args = arguments;
37
36
  return _regenerator.default.wrap(function _callee$(_context) {
38
- while (1) {
39
- switch (_context.prev = _context.next) {
40
- case 0:
41
- options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
42
- promises = [];
43
- fileMap = {};
44
- _context.prev = 3;
45
- jsZip = new _jszip.default();
46
- _context.next = 7;
47
- return jsZip.loadAsync(data, options);
48
- case 7:
49
- zip = _context.sent;
50
- zip.forEach(function (relativePath, zipEntry) {
51
- var subFilename = zipEntry.name;
52
- var promise = loadZipEntry(jsZip, subFilename, options).then(function (arrayBufferOrError) {
53
- fileMap[relativePath] = arrayBufferOrError;
54
- });
55
-
56
- promises.push(promise);
37
+ while (1) switch (_context.prev = _context.next) {
38
+ case 0:
39
+ options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
40
+ promises = [];
41
+ fileMap = {};
42
+ _context.prev = 3;
43
+ jsZip = new _jszip.default();
44
+ _context.next = 7;
45
+ return jsZip.loadAsync(data, options);
46
+ case 7:
47
+ zip = _context.sent;
48
+ zip.forEach(function (relativePath, zipEntry) {
49
+ var subFilename = zipEntry.name;
50
+ var promise = loadZipEntry(jsZip, subFilename, options).then(function (arrayBufferOrError) {
51
+ fileMap[relativePath] = arrayBufferOrError;
57
52
  });
58
- _context.next = 11;
59
- return Promise.all(promises);
60
- case 11:
61
- return _context.abrupt("return", fileMap);
62
- case 14:
63
- _context.prev = 14;
64
- _context.t0 = _context["catch"](3);
65
- options.log.error("Unable to read zip archive: ".concat(_context.t0));
66
- throw _context.t0;
67
- case 18:
68
- case "end":
69
- return _context.stop();
70
- }
53
+ promises.push(promise);
54
+ });
55
+ _context.next = 11;
56
+ return Promise.all(promises);
57
+ case 11:
58
+ return _context.abrupt("return", fileMap);
59
+ case 14:
60
+ _context.prev = 14;
61
+ _context.t0 = _context["catch"](3);
62
+ options.log.error("Unable to read zip archive: ".concat(_context.t0));
63
+ throw _context.t0;
64
+ case 18:
65
+ case "end":
66
+ return _context.stop();
71
67
  }
72
68
  }, _callee, null, [[3, 14]]);
73
69
  }));
@@ -82,25 +78,23 @@ function _loadZipEntry() {
82
78
  arrayBuffer,
83
79
  _args2 = arguments;
84
80
  return _regenerator.default.wrap(function _callee2$(_context2) {
85
- while (1) {
86
- switch (_context2.prev = _context2.next) {
87
- case 0:
88
- options = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {};
89
- _context2.prev = 1;
90
- _context2.next = 4;
91
- return jsZip.file(subFilename).async(options.dataType || 'arraybuffer');
92
- case 4:
93
- arrayBuffer = _context2.sent;
94
- return _context2.abrupt("return", arrayBuffer);
95
- case 8:
96
- _context2.prev = 8;
97
- _context2.t0 = _context2["catch"](1);
98
- options.log.error("Unable to read ".concat(subFilename, " from zip archive: ").concat(_context2.t0));
99
- return _context2.abrupt("return", _context2.t0);
100
- case 12:
101
- case "end":
102
- return _context2.stop();
103
- }
81
+ while (1) switch (_context2.prev = _context2.next) {
82
+ case 0:
83
+ options = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {};
84
+ _context2.prev = 1;
85
+ _context2.next = 4;
86
+ return jsZip.file(subFilename).async(options.dataType || 'arraybuffer');
87
+ case 4:
88
+ arrayBuffer = _context2.sent;
89
+ return _context2.abrupt("return", arrayBuffer);
90
+ case 8:
91
+ _context2.prev = 8;
92
+ _context2.t0 = _context2["catch"](1);
93
+ options.log.error("Unable to read ".concat(subFilename, " from zip archive: ").concat(_context2.t0));
94
+ return _context2.abrupt("return", _context2.t0);
95
+ case 12:
96
+ case "end":
97
+ return _context2.stop();
104
98
  }
105
99
  }, _callee2, null, [[1, 8]]);
106
100
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"zip-loader.js","names":["VERSION","ZipLoader","id","module","name","version","extensions","mimeTypes","category","tests","options","parse","parseZipAsync","data","promises","fileMap","jsZip","JSZip","loadAsync","zip","forEach","relativePath","zipEntry","subFilename","promise","loadZipEntry","then","arrayBufferOrError","push","Promise","all","log","error","file","async","dataType","arrayBuffer","_typecheckZipLoader"],"sources":["../../src/zip-loader.ts"],"sourcesContent":["// Zip loader\nimport type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport JSZip from 'jszip';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport const ZipLoader = {\n id: 'zip',\n module: 'zip',\n name: 'Zip Archive',\n version: VERSION,\n extensions: ['zip'],\n mimeTypes: ['application/zip'],\n category: 'archive',\n tests: ['PK'],\n options: {},\n parse: parseZipAsync\n};\n\ntype FileMap = Record<string, ArrayBuffer>;\n\n// TODO - Could return a map of promises, perhaps as an option...\nasync function parseZipAsync(data: any, options = {}): Promise<FileMap> {\n const promises: Promise<any>[] = [];\n const fileMap: Record<string, ArrayBuffer> = {};\n\n try {\n const jsZip = new JSZip();\n\n const zip = await jsZip.loadAsync(data, options);\n\n // start to load each file in this zip\n zip.forEach((relativePath, zipEntry) => {\n const subFilename = zipEntry.name;\n\n const promise = loadZipEntry(jsZip, subFilename, options).then((arrayBufferOrError) => {\n fileMap[relativePath] = arrayBufferOrError;\n });\n\n // Ensure Promise.all doesn't ignore rejected promises.\n promises.push(promise);\n });\n\n await Promise.all(promises);\n return fileMap;\n } catch (error) {\n // @ts-ignore\n options.log.error(`Unable to read zip archive: ${error}`);\n throw error;\n }\n}\n\nasync function loadZipEntry(jsZip: any, subFilename: string, options: any = {}) {\n // jszip supports both arraybuffer and text, the main loaders.gl types\n // https://stuk.github.io/jszip/documentation/api_zipobject/async.html\n try {\n const arrayBuffer = await jsZip.file(subFilename).async(options.dataType || 'arraybuffer');\n return arrayBuffer;\n } catch (error) {\n options.log.error(`Unable to read ${subFilename} from zip archive: ${error}`);\n // Store error in place of data in map\n return error;\n }\n}\n\nexport const _typecheckZipLoader: LoaderWithParser = ZipLoader;\n"],"mappings":";;;;;;;;;AAEA;;AAIA,IAAMA,OAAO,GAAG,sBAAkB,K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AC;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,CAG7D;EAAA;AAAA;AAAA,SAEcP,YAAY;EAAA;AAAA;AAAA;EAAA,0EAA3B,kBAA4BT,KAAU,EAAEO,WAAmB;IAAA;MAAA;MAAA;IAAA;MAAA;QAAA;UAAA;YAAEb,OAAY,8DAAG,CAAC,CAAC;YAAA;YAAA;YAAA,OAIhDM,KAAK,CAACiB,IAAI,CAACV,WAAW,CAAC,CAACW,KAAK,CAACxB,OAAO,CAACyB,QAAQ,IAAI,aAAa,CAAC;UAAA;YAApFC,WAAW;YAAA,kCACVA,WAAW;UAAA;YAAA;YAAA;YAElB1B,OAAO,CAACqB,GAAG,CAACC,KAAK,0BAAmBT,WAAW,8CAA8B;YAAC;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,CAIjF;EAAA;AAAA;AAEM,IAAMc,mBAAqC,GAAGpC,SAAS;AAAC"}
1
+ {"version":3,"file":"zip-loader.js","names":["_jszip","_interopRequireDefault","require","VERSION","ZipLoader","id","module","name","version","extensions","mimeTypes","category","tests","options","parse","parseZipAsync","exports","_x","_parseZipAsync","apply","arguments","_asyncToGenerator2","default","_regenerator","mark","_callee","data","promises","fileMap","jsZip","zip","_args","wrap","_callee$","_context","prev","next","length","undefined","JSZip","loadAsync","sent","forEach","relativePath","zipEntry","subFilename","promise","loadZipEntry","then","arrayBufferOrError","push","Promise","all","abrupt","t0","log","error","concat","stop","_x2","_x3","_loadZipEntry","_callee2","arrayBuffer","_args2","_callee2$","_context2","file","async","dataType","_typecheckZipLoader"],"sources":["../../src/zip-loader.ts"],"sourcesContent":["// Zip loader\nimport type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport JSZip from 'jszip';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport const ZipLoader = {\n id: 'zip',\n module: 'zip',\n name: 'Zip Archive',\n version: VERSION,\n extensions: ['zip'],\n mimeTypes: ['application/zip'],\n category: 'archive',\n tests: ['PK'],\n options: {},\n parse: parseZipAsync\n};\n\ntype FileMap = Record<string, ArrayBuffer>;\n\n// TODO - Could return a map of promises, perhaps as an option...\nasync function parseZipAsync(data: any, options = {}): Promise<FileMap> {\n const promises: Promise<any>[] = [];\n const fileMap: Record<string, ArrayBuffer> = {};\n\n try {\n const jsZip = new JSZip();\n\n const zip = await jsZip.loadAsync(data, options);\n\n // start to load each file in this zip\n zip.forEach((relativePath, zipEntry) => {\n const subFilename = zipEntry.name;\n\n const promise = loadZipEntry(jsZip, subFilename, options).then((arrayBufferOrError) => {\n fileMap[relativePath] = arrayBufferOrError;\n });\n\n // Ensure Promise.all doesn't ignore rejected promises.\n promises.push(promise);\n });\n\n await Promise.all(promises);\n return fileMap;\n } catch (error) {\n // @ts-ignore\n options.log.error(`Unable to read zip archive: ${error}`);\n throw error;\n }\n}\n\nasync function loadZipEntry(jsZip: any, subFilename: string, options: any = {}) {\n // jszip supports both arraybuffer and text, the main loaders.gl types\n // https://stuk.github.io/jszip/documentation/api_zipobject/async.html\n try {\n const arrayBuffer = await jsZip.file(subFilename).async(options.dataType || 'arraybuffer');\n return arrayBuffer;\n } catch (error) {\n options.log.error(`Unable to read ${subFilename} from zip archive: ${error}`);\n // Store error in place of data in map\n return error;\n }\n}\n\nexport const _typecheckZipLoader: LoaderWithParser = ZipLoader;\n"],"mappings":";;;;;;;;;AAEA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIA,IAAMC,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,QAAQ;AAEpE,IAAMC,SAAS,GAAG;EACvBC,EAAE,EAAE,KAAK;EACTC,MAAM,EAAE,KAAK;EACbC,IAAI,EAAE,aAAa;EACnBC,OAAO,EAAEL,OAAO;EAChBM,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,SAAS,EAAE,CAAC,iBAAiB,CAAC;E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I,CAACtB,WAAW,CAAC,CAACuB,KAAK,CAACvD,OAAO,CAACwD,QAAQ,IAAI,aAAa,CAAC;QAAA;UAApFN,WAAW,GAAAG,SAAA,CAAAzB,IAAA;UAAA,OAAAyB,SAAA,CAAAb,MAAA,WACVU,WAAW;QAAA;UAAAG,SAAA,CAAA/B,IAAA;UAAA+B,SAAA,CAAAZ,EAAA,GAAAY,SAAA;UAElBrD,OAAO,CAAC0C,GAAG,CAACC,KAAK,mBAAAC,MAAA,CAAmBZ,WAAW,yBAAAY,MAAA,CAAAS,SAAA,CAAAZ,EAAA,CAA6B,CAAC;UAAC,OAAAY,SAAA,CAAAb,MAAA,WAAAa,SAAA,CAAAZ,EAAA;QAAA;QAAA;UAAA,OAAAY,SAAA,CAAAR,IAAA;MAAA;IAAA,GAAAI,QAAA;EAAA,CAIjF;EAAA,OAAAD,aAAA,CAAA1C,KAAA,OAAAC,SAAA;AAAA;AAEM,IAAMkD,mBAAqC,GAAGlE,SAAS;AAACY,OAAA,CAAAsD,mBAAA,GAAAA,mBAAA"}
@@ -30,28 +30,25 @@ function _encodeZipAsync() {
30
30
  onUpdate,
31
31
  _args = arguments;
32
32
  return _regenerator.default.wrap(function _callee$(_context) {
33
- while (1) {
34
- switch (_context.prev = _context.next) {
35
- case 0:
36
- options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
37
- jsZip = new _jszip.default();
38
- for (subFileName in fileMap) {
39
- subFileData = fileMap[subFileName];
40
- jsZip.file(subFileName, subFileData, options);
41
- }
42
-
43
- options = Object.assign({}, options, {
44
- type: 'arraybuffer'
45
- });
46
- _options = options, _options$onUpdate = _options.onUpdate, onUpdate = _options$onUpdate === void 0 ? function () {} : _options$onUpdate;
47
- return _context.abrupt("return", jsZip.generateAsync(options, onUpdate).catch(function (error) {
48
- options.log.error("Unable to write zip archive: ".concat(error));
49
- throw error;
50
- }));
51
- case 6:
52
- case "end":
53
- return _context.stop();
54
- }
33
+ while (1) switch (_context.prev = _context.next) {
34
+ case 0:
35
+ options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
36
+ jsZip = new _jszip.default();
37
+ for (subFileName in fileMap) {
38
+ subFileData = fileMap[subFileName];
39
+ jsZip.file(subFileName, subFileData, options);
40
+ }
41
+ options = Object.assign({}, options, {
42
+ type: 'arraybuffer'
43
+ });
44
+ _options = options, _options$onUpdate = _options.onUpdate, onUpdate = _options$onUpdate === void 0 ? function () {} : _options$onUpdate;
45
+ return _context.abrupt("return", jsZip.generateAsync(options, onUpdate).catch(function (error) {
46
+ options.log.error("Unable to write zip archive: ".concat(error));
47
+ throw error;
48
+ }));
49
+ case 6:
50
+ case "end":
51
+ return _context.stop();
55
52
  }
56
53
  }, _callee);
57
54
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"zip-writer.js","names":["ZipWriter","name","extensions","category","mimeTypes","encode","encodeZipAsync","fileMap","options","jsZip","JSZip","subFileName","subFileData","file","Object","assign","type","onUpdate","generateAsync","catch","error","log"],"sources":["../../src/zip-writer.ts"],"sourcesContent":["import type {Writer} from '@loaders.gl/loader-utils';\nimport JSZip from 'jszip';\n\n/**\n * Zip exporter\n */\nexport const ZipWriter: Writer = {\n name: 'Zip Archive',\n extensions: ['zip'],\n category: 'archive',\n mimeTypes: ['application/zip'],\n // @ts-ignore\n encode: encodeZipAsync\n};\n\nasync function encodeZipAsync(fileMap: any, options: any = {}) {\n const jsZip = new JSZip();\n // add files to the zip\n for (const subFileName in fileMap) {\n const subFileData = fileMap[subFileName];\n\n // jszip supports both arraybuffer and string data (the main loaders.gl types)\n // https://stuk.github.io/jszip/documentation/api_zipobject/async.html\n jsZip.file(subFileName, subFileData, options);\n }\n\n // always generate the full zip as an arraybuffer\n options = Object.assign({}, options, {\n type: 'arraybuffer'\n });\n const {onUpdate = () => {}} = options;\n\n return jsZip.generateAsync(options, onUpdate).catch((error) => {\n options.log.error(`Unable to write zip archive: ${error}`);\n throw error;\n });\n}\n"],"mappings":";;;;;;;;;AACA;AAKO,IAAMA,SAAiB,GAAG;EAC/BC,IAAI,EAAE,aAAa;EACnBC,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,QAAQ,EAAE,SAAS;EACnBC,SAAS,EAAE,CAAC,iBAAiB,CAAC;EAE9BC,MAAM,EAAEC;AACV,CAAC;AAAC;AAAA,SAEaA,cAAc;EAAA;AAAA;AAAA;EAAA,4EAA7B,iBAA8BC,OAAY;IAAA;MAAA;MAAA;MAAA;MAAA;MAAA;MAAA;MAAA;IAAA;MAAA;QAAA;UAAA;YAAEC,OAAY,2DAAG,CAAC,CAAC;YACrDC,KAAK,GAAG,IAAIC,cAAK,EAAE;YAEzB,KAAWC,WAAW,IAAIJ,OAAO,EAAE;cAC3BK,WAAW,GAAGL,OAAO,CAACI,WAAW,CAAC;cAIxCF,KAAK,CAACI,IAAI,CAACF,WAAW,EAAEC,WAAW,EAAEJ,OAAO,CAAC;YAC/C;;YAGAA,OAAO,GAAGM,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,EAAEP,OAAO,EAAE;cACnCQ,IAAI,EAAE;YACR,CAAC,CAAC;YAAC,WAC2BR,OAAO,+BAA9BS,QAAQ,EAARA,QAAQ,kCAAG,YAAM,CAAC,CAAC;YAAA,iCAEnBR,KAAK,CAACS,aAAa,CAACV,OAAO,EAAES,QAAQ,CAAC,CAACE,KAAK,CAAC,UAACC,KAAK,EAAK;cAC7DZ,OAAO,CAACa,GAAG,CAACD,KAAK,wCAAiCA,KAAK,EAAG;cAC1D,MAAMA,KAAK;YACb,CAAC,CAAC;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,CACH;EAAA;AAAA"}
1
+ {"version":3,"file":"zip-writer.js","names":["_jszip","_interopRequireDefault","require","ZipWriter","name","extensions","category","mimeTypes","encode","encodeZipAsync","exports","_x","_encodeZipAsync","apply","arguments","_asyncToGenerator2","default","_regenerator","mark","_callee","fileMap","options","jsZip","subFileName","subFileData","_options","_options$onUpdate","onUpdate","_args","wrap","_callee$","_context","prev","next","length","undefined","JSZip","file","Object","assign","type","abrupt","generateAsync","catch","error","log","concat","stop"],"sources":["../../src/zip-writer.ts"],"sourcesContent":["import type {Writer} from '@loaders.gl/loader-utils';\nimport JSZip from 'jszip';\n\n/**\n * Zip exporter\n */\nexport const ZipWriter: Writer = {\n name: 'Zip Archive',\n extensions: ['zip'],\n category: 'archive',\n mimeTypes: ['application/zip'],\n // @ts-ignore\n encode: encodeZipAsync\n};\n\nasync function encodeZipAsync(fileMap: any, options: any = {}) {\n const jsZip = new JSZip();\n // add files to the zip\n for (const subFileName in fileMap) {\n const subFileData = fileMap[subFileName];\n\n // jszip supports both arraybuffer and string data (the main loaders.gl types)\n // https://stuk.github.io/jszip/documentation/api_zipobject/async.html\n jsZip.file(subFileName, subFileData, options);\n }\n\n // always generate the full zip as an arraybuffer\n options = Object.assign({}, options, {\n type: 'arraybuffer'\n });\n const {onUpdate = () => {}} = options;\n\n return jsZip.generateAsync(options, onUpdate).catch((error) => {\n options.log.error(`Unable to write zip archive: ${error}`);\n throw error;\n });\n}\n"],"mappings":";;;;;;;;;AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKO,IAAMC,SAAiB,GAAG;EAC/BC,IAAI,EAAE,aAAa;EACnBC,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,QAAQ,EAAE,SAAS;EACnBC,SAAS,EAAE,CAAC,iBAAiB,CAAC;EAE9BC,MAAM,EAAEC;AACV,CAAC;AAACC,OAAA,CAAAP,SAAA,GAAAA,SAAA;AAAA,SAEaM,cAAcA,CAAAE,EAAA;EAAA,OAAAC,eAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAAA,SAAAF,gBAAA;EAAAA,eAAA,OAAAG,kBAAA,CAAAC,OAAA,EAAAC,YAAA,CAAAD,OAAA,CAAAE,IAAA,CAA7B,SAAAC,QAA8BC,OAAY;IAAA,IAAAC,OAAA;MAAAC,KAAA;MAAAC,WAAA;MAAAC,WAAA;MAAAC,QAAA;MAAAC,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ders, moduleExports);
@@ -1 +1 @@
1
- {"version":3,"file":"bundle.js","names":["moduleExports","require","globalThis","loaders","module","exports","Object","assign"],"sources":["../../src/bundle.ts"],"sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.loaders = globalThis.loaders || {};\nmodule.exports = Object.assign(globalThis.loaders, moduleExports);\n"],"mappings":";AACA,MAAMA,aAAa,GAAGC,OAAO,CAAC,SAAS,CAAC;AACxCC,UAAU,CAACC,OAAO,GAAGD,UAAU,CAACC,OAAO,IAAI,CAAC,CAAC;AAC7CC,MAAM,CAACC,OAAO,GAAGC,MAAM,CAACC,MAAM,CAACL,UAAU,CAACC,OAAO,EAAEH,aAAa,CAAC"}
1
+ {"version":3,"file":"bundle.js","names":["moduleExports","require","globalThis","loaders","module","exports","Object","assign"],"sources":["../../src/bundle.ts"],"sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.loaders = globalThis.loaders || {};\nmodule.exports = Object.assign(globalThis.loaders, moduleExports);\n"],"mappings":"AACA,MAAMA,aAAa,GAAGC,OAAO,CAAC,SAAS,CAAC;AACxCC,UAAU,CAACC,OAAO,GAAGD,UAAU,CAACC,OAAO,IAAI,CAAC,CAAC;AAC7CC,MAAM,CAACC,OAAO,GAAGC,MAAM,CAACC,MAAM,CAACL,UAAU,CAACC,OAAO,EAAEH,aAAa,CAAC"}
@@ -1,6 +1,4 @@
1
-
2
1
  import * as utils from './utils';
3
-
4
2
  const structure = {
5
3
  fileName: 100,
6
4
  fileMode: 8,
@@ -31,7 +29,6 @@ export function format(data, cb) {
31
29
  buffer[offset] = str.charCodeAt(i);
32
30
  offset += 1;
33
31
  }
34
-
35
32
  offset += length - i;
36
33
  });
37
34
  if (typeof cb === 'function') {
@@ -1 +1 @@
1
- {"version":3,"file":"header.js","names":["utils","structure","fileName","fileMode","uid","gid","fileSize","mtime","checksum","type","linkName","ustar","owner","group","majorNumber","minorNumber","filenamePrefix","padding","format","data","cb","buffer","clean","offset","Object","entries","forEach","field","length","str","i","fieldLength","charCodeAt"],"sources":["../../../../src/lib/tar/header.ts"],"sourcesContent":["// This file is derived from the tar-js code base under MIT license\n// See https://github.com/beatgammit/tar-js/blob/master/LICENSE\n/*\n * tar-js\n * MIT (c) 2011 T. Jameson Little\n */\n/* eslint-disable */\nimport * as utils from './utils';\nimport type {TarStructure, TarData} from './types';\n/*\nstruct posix_header { // byte offset\n\tchar name[100]; // 0\n\tchar mode[8]; // 100\n\tchar uid[8]; // 108\n\tchar gid[8]; // 116\n\tchar size[12]; // 124\n\tchar mtime[12]; // 136\n\tchar chksum[8]; // 148\n\tchar typeflag; // 156\n\tchar linkname[100]; // 157\n\tchar magic[6]; // 257\n\tchar version[2]; // 263\n\tchar uname[32]; // 265\n\tchar gname[32]; // 297\n\tchar devmajor[8]; // 329\n\tchar devminor[8]; // 337\n\tchar prefix[155]; // 345\n // 500\n};\n*/\n\nconst structure: TarStructure = {\n fileName: 100,\n fileMode: 8,\n uid: 8,\n gid: 8,\n fileSize: 12,\n mtime: 12,\n checksum: 8,\n type: 1,\n linkName: 100,\n ustar: 8,\n owner: 32,\n group: 32,\n majorNumber: 8,\n minorNumber: 8,\n filenamePrefix: 155,\n padding: 12\n};\n/**\n * Getting the header\n * @param data\n * @param [cb]\n * @returns {Uint8Array} | Array\n */\nexport function format(data: TarData, cb?: any): [string, number][] | Uint8Array {\n const buffer = utils.clean(512);\n let offset = 0;\n\n Object.entries(structure).forEach(([field, length]) => {\n const str = data[field] || '';\n let i: number;\n let fieldLength: number;\n\n for (i = 0, fieldLength = str.length; i < fieldLength; i += 1) {\n buffer[offset] = str.charCodeAt(i);\n offset += 1;\n }\n\n // space it out with nulls\n offset += length - i;\n });\n\n if (typeof cb === 'function') {\n return cb(buffer, offset);\n }\n return buffer;\n}\n"],"mappings":";AAOA,OAAO,KAAKA,KAAK,MAAM,SAAS;;AAwBhC,MAAMC,SAAuB,GAAG;EAC9BC,QAAQ,EAAE,GAAG;EACbC,QAAQ,EAAE,CAAC;EACXC,GAAG,EAAE,CAAC;EACNC,GAAG,EAAE,CAAC;EACNC,QAAQ,EAAE,EAAE;EACZC,KAAK,EAAE,EAAE;EACTC,QAAQ,EAAE,CAAC;EACXC,IAAI,EAAE,CAAC;EACPC,QAAQ,EAAE,GAAG;EACbC,KAAK,EAAE,CAAC;EACRC,KAAK,EAAE,EAAE;EACTC,KAAK,EAAE,EAAE;EACTC,WAAW,EAAE,CAAC;EACdC,WAAW,EAAE,CAAC;EACdC,cAAc,EAAE,GAAG;EACnBC,OAAO,EAAE;AACX,CAAC;AAOD,OAAO,SAASC,MAAM,CAACC,IAAa,EAAEC,EAAQ,EAAmC;EAC/E,MAAMC,MAAM,GAAGrB,KAAK,CAACsB,KAAK,CAAC,GAAG,CAAC;EAC/B,IAAIC,MAAM,GAAG,CAAC;EAEdC,MAAM,CAACC,OAAO,CAACxB,SAAS,CAAC,CAACyB,OAAO,CAAC,QAAqB;IAAA,IAApB,CAACC,KAAK,EAAEC,MAAM,CAAC;IAChD,MAAMC,GAAG,GAAGV,IAAI,CAACQ,KAAK,CAAC,IAAI,EAAE;IAC7B,IAAIG,CAAS;IACb,IAAIC,WAAmB;IAEvB,KAAKD,CAAC,GAAG,CAAC,EAAEC,WAAW,GAAGF,GAAG,CAACD,MAAM,EAAEE,CAAC,GAAGC,WAAW,EAAED,CAAC,IAAI,CAAC,EAAE;MAC7DT,MAAM,CAACE,MAAM,CAAC,GAAGM,GAAG,CAACG,UAAU,CAACF,CAAC,CAAC;MAClCP,MAAM,IAAI,CAAC;IACb;;IAGAA,MAAM,IAAIK,MAAM,GAAGE,CAAC;EACtB,CAAC,CAAC;EAEF,IAAI,OAAOV,EAAE,KAAK,UAAU,EAAE;IAC5B,OAAOA,EAAE,CAACC,MAAM,EAAEE,MAAM,CAAC;EAC3B;EACA,OAAOF,MAAM;AACf"}
1
+ {"version":3,"file":"header.js","names":["utils","structure","fileName","fileMode","uid","gid","fileSize","mtime","checksum","type","linkName","ustar","owner","group","majorNumber","minorNumber","filenamePrefix","padding","format","data","cb","buffer","clean","offset","Object","entries","forEach","_ref","field","length","str","i","fieldLength","charCodeAt"],"sources":["../../../../src/lib/tar/header.ts"],"sourcesContent":["// This file is derived from the tar-js code base under MIT license\n// See https://github.com/beatgammit/tar-js/blob/master/LICENSE\n/*\n * tar-js\n * MIT (c) 2011 T. Jameson Little\n */\n/* eslint-disable */\nimport * as utils from './utils';\nimport type {TarStructure, TarData} from './types';\n/*\nstruct posix_header { // byte offset\n\tchar name[100]; // 0\n\tchar mode[8]; // 100\n\tchar uid[8]; // 108\n\tchar gid[8]; // 116\n\tchar size[12]; // 124\n\tchar mtime[12]; // 136\n\tchar chksum[8]; // 148\n\tchar typeflag; // 156\n\tchar linkname[100]; // 157\n\tchar magic[6]; // 257\n\tchar version[2]; // 263\n\tchar uname[32]; // 265\n\tchar gname[32]; // 297\n\tchar devmajor[8]; // 329\n\tchar devminor[8]; // 337\n\tchar prefix[155]; // 345\n // 500\n};\n*/\n\nconst structure: TarStructure = {\n fileName: 100,\n fileMode: 8,\n uid: 8,\n gid: 8,\n fileSize: 12,\n mtime: 12,\n checksum: 8,\n type: 1,\n linkName: 100,\n ustar: 8,\n owner: 32,\n group: 32,\n majorNumber: 8,\n minorNumber: 8,\n filenamePrefix: 155,\n padding: 12\n};\n/**\n * Getting the header\n * @param data\n * @param [cb]\n * @returns {Uint8Array} | Array\n */\nexport function format(data: TarData, cb?: any): [string, number][] | Uint8Array {\n const buffer = utils.clean(512);\n let offset = 0;\n\n Object.entries(structure).forEach(([field, length]) => {\n const str = data[field] || '';\n let i: number;\n let fieldLength: number;\n\n for (i = 0, fieldLength = str.length; i < fieldLength; i += 1) {\n buffer[offset] = str.charCodeAt(i);\n offset += 1;\n }\n\n // space it out with nulls\n offset += length - i;\n });\n\n if (typeof cb === 'function') {\n return cb(buffer, offset);\n }\n return buffer;\n}\n"],"mappings":"AAOA,OAAO,KAAKA,KAAK,MAAM,SAAS;AAwBhC,MAAMC,S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 +1,4 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
-
3
2
  import { clean, pad, stringToUint8 } from './utils';
4
3
  import { format } from './header';
5
4
  let blockSize;
@@ -21,7 +20,6 @@ class Tar {
21
20
  this.clear = this.clear.bind(this);
22
21
  this.append = this.append.bind(this);
23
22
  }
24
-
25
23
  append(filepath, input, opts) {
26
24
  let checksum;
27
25
  if (typeof input === 'string') {
@@ -50,7 +48,6 @@ class Tar {
50
48
  owner: opts.owner || '',
51
49
  group: opts.group || ''
52
50
  };
53
-
54
51
  checksum = 0;
55
52
  Object.keys(data).forEach(key => {
56
53
  let i;
@@ -1 +1 @@
1
- {"version":3,"file":"tar.js","names":["clean","pad","stringToUint8","format","blockSize","headerLength","inputLength","recordSize","Tar","constructor","recordsPerBlock","written","out","blocks","length","save","bind","clear","append","filepath","input","opts","checksum","Uint8Array","prototype","errorInputMatch","exec","toString","errorInput","errorMessage","mode","parseInt","mtime","Math","floor","Number","Date","uid","gid","data","fileName","fileMode","fileSize","type","ustar","owner","group","Object","keys","forEach","key","i","value","charCodeAt","headerArr","ceil","push","header","buffers","chunks","Array","max","pow","chunk","b","c","buffer","set","Blob"],"sources":["../../../../src/lib/tar/tar.ts"],"sourcesContent":["// This file is derived from the tar-js code base under MIT license\n// See https://github.com/beatgammit/tar-js/blob/master/LICENSE\n/*\n * tar-js\n * MIT (c) 2011 T. Jameson Little\n */\n\nimport {clean, pad, stringToUint8} from './utils';\nimport {format} from './header';\nimport type {TarBlocks, TarOptions, TarChunks, TarChunk} from './types';\n\nlet blockSize: number;\nlet headerLength: number;\nlet inputLength: number;\n\nconst recordSize = 512;\n\nclass Tar {\n written: number;\n out: Uint8Array;\n blocks: TarBlocks = [];\n length: number;\n\n /**\n * @param [recordsPerBlock]\n */\n constructor(recordsPerBlock: number | undefined) {\n this.written = 0;\n blockSize = (recordsPerBlock || 20) * recordSize;\n this.out = clean(blockSize);\n\n this.blocks = [];\n this.length = 0;\n this.save = this.save.bind(this);\n this.clear = this.clear.bind(this);\n this.append = this.append.bind(this);\n }\n\n /**\n * Append a file to the tar archive\n * @param filepath\n * @param input\n * @param [opts]\n */\n // eslint-disable-next-line complexity\n append(filepath: string, input: string | Uint8Array, opts?: TarOptions | undefined) {\n let checksum: string | any;\n\n if (typeof input === 'string') {\n input = stringToUint8(input);\n } else if (input.constructor && input.constructor !== Uint8Array.prototype.constructor) {\n // @ts-ignore\n const errorInputMatch = /function\\s*([$A-Za-z_][0-9A-Za-z_]*)\\s*\\(/.exec(\n input.constructor.toString()\n );\n const errorInput = errorInputMatch && errorInputMatch[1];\n const errorMessage = `Invalid input type. You gave me: ${errorInput}`;\n throw errorMessage;\n }\n\n opts = opts || {};\n\n const mode = opts.mode || parseInt('777', 8) & 0xfff;\n const mtime = opts.mtime || Math.floor(Number(new Date()) / 1000);\n const uid = opts.uid || 0;\n const gid = opts.gid || 0;\n\n const data: Record<string, string> = {\n fileName: filepath,\n fileMode: pad(mode, 7),\n uid: pad(uid, 7),\n gid: pad(gid, 7),\n fileSize: pad(input.length, 11),\n mtime: pad(mtime, 11),\n checksum: ' ',\n // 0 = just a file\n type: '0',\n ustar: 'ustar ',\n owner: opts.owner || '',\n group: opts.group || ''\n };\n\n // calculate the checksum\n checksum = 0;\n Object.keys(data).forEach((key) => {\n let i: number;\n const value = data[key];\n let length: number;\n\n for (i = 0, length = value.length; i < length; i += 1) {\n checksum += value.charCodeAt(i);\n }\n });\n\n data.checksum = `${pad(checksum, 6)}\\u0000 `;\n\n const headerArr = format(data);\n\n headerLength = Math.ceil(headerArr.length / recordSize) * recordSize;\n inputLength = Math.ceil(input.length / recordSize) * recordSize;\n\n this.blocks.push({\n header: headerArr,\n input,\n headerLength,\n inputLength\n });\n }\n /**\n * Compiling data to a Blob object\n * @returns {Blob}\n */\n save(): Blob {\n const buffers: any = [];\n const chunks = new Array<TarChunks>();\n let length = 0;\n const max = Math.pow(2, 20);\n\n let chunk = new Array<TarChunk>();\n this.blocks.forEach((b: any = []) => {\n if (length + b.headerLength + b.inputLength > max) {\n chunks.push({blocks: chunk, length});\n chunk = [];\n length = 0;\n }\n chunk.push(b);\n length += b.headerLength + b.inputLength;\n });\n chunks.push({blocks: chunk, length});\n\n chunks.forEach((c: any = []) => {\n const buffer = new Uint8Array(c.length);\n let written = 0;\n c.blocks.forEach((b: any = []) => {\n buffer.set(b.header, written);\n written += b.headerLength;\n buffer.set(b.input, written);\n written += b.inputLength;\n });\n buffers.push(buffer);\n });\n\n buffers.push(new Uint8Array(2 * recordSize));\n\n return new Blob(buffers, {type: 'octet/stream'});\n }\n /**\n * Clear the data by its blocksize\n */\n clear() {\n this.written = 0;\n this.out = clean(blockSize);\n }\n}\n\nexport default Tar;\n"],"mappings":";;AAOA,SAAQA,KAAK,EAAEC,GAAG,EAAEC,aAAa,QAAO,SAAS;AACjD,SAAQC,MAAM,QAAO,UAAU;AAG/B,IAAIC,SAAiB;AACrB,IAAIC,YAAoB;AACxB,IAAIC,WAAmB;AAEvB,MAAMC,UAAU,GAAG,GAAG;AAEtB,MAAMC,GAAG,CAAC;EASRC,WAAW,CAACC,eAAmC,EAAE;IAAA;IAAA;IAAA,gCAN7B,EAAE;IAAA;IAOpB,IAAI,CAACC,OAAO,GAAG,CAAC;IAChBP,SAAS,GAAG,CAACM,eAAe,IAAI,EAAE,IAAIH,UAAU;IAChD,IAAI,CAACK,GAAG,GAAGZ,KAAK,CAACI,SAAS,CAAC;IAE3B,IAAI,CAACS,MAAM,GAAG,EAAE;IAChB,IAAI,CAACC,MAAM,GAAG,CAAC;IACf,IAAI,CAACC,IAAI,GAAG,IAAI,CAACA,IAAI,CAACC,IAAI,CAAC,IAAI,CAAC;IAChC,IAAI,CAACC,KAAK,GAAG,IAAI,CAACA,KAAK,CAACD,IAAI,CAAC,IAAI,CAAC;IAClC,IAAI,CAACE,MAAM,GAAG,IAAI,CAACA,MAAM,CAACF,IAAI,CAAC,IAAI,CAAC;EACtC;;EASAE,MAAM,CAACC,QAAgB,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;IAEFR,OAAO,CAACF,IAAI,CAAC,IAAIjC,UAAU,CAAC,CAAC,GAAGhB,UAAU,CAAC,CAAC;IAE5C,OAAO,IAAI6D,IAAI,CAACV,OAAO,EAAE;MAACf,IAAI,EAAE;IAAc,CAAC,CAAC;EAClD;EAIA1B,KAAK,GAAG;IACN,IAAI,CAACN,OAAO,GAAG,CAAC;IAChB,IAAI,CAACC,GAAG,GAAGZ,KAAK,CAACI,SAAS,CAAC;EAC7B;AACF;AAEA,eAAeI,GAAG"}
1
+ {"version":3,"file":"tar.js","names":["clean","pad","stringToUint8","format","blockSize","headerLength","inputLength","recordSize","Tar","constructor","recordsPerBlock","_defineProperty","written","out","blocks","length","save","bind","clear","append","filepath","input","opts","checksum","Uint8Array","prototype","errorInputMatch","exec","toString","errorInput","errorMessage","concat","mode","parseInt","mtime","Math","floor","Number","Date","uid","gid","data","fileName","fileMode","fileSize","type","ustar","owner","group","Object","keys","forEach","key","i","value","charCodeAt","headerArr","ceil","push","header","buffers","chunks","Array","max","pow","chunk","b","arguments","undefined","c","buffer","set","Blob"],"sources":["../../../../src/lib/tar/tar.ts"],"sourcesContent":["// This file is derived from the tar-js code base under MIT license\n// See https://github.com/beatgammit/tar-js/blob/master/LICENSE\n/*\n * tar-js\n * MIT (c) 2011 T. Jameson Little\n */\n\nimport {clean, pad, stringToUint8} from './utils';\nimport {format} from './header';\nimport type {TarBlocks, TarOptions, TarChunks, TarChunk} from './types';\n\nlet blockSize: number;\nlet headerLength: number;\nlet inputLength: number;\n\nconst recordSize = 512;\n\nclass Tar {\n written: number;\n out: Uint8Array;\n blocks: TarBlocks = [];\n length: number;\n\n /**\n * @param [recordsPerBlock]\n */\n constructor(recordsPerBlock: number | undefined) {\n this.written = 0;\n blockSize = (recordsPerBlock || 20) * recordSize;\n this.out = clean(blockSize);\n\n this.blocks = [];\n this.length = 0;\n this.save = this.save.bind(this);\n this.clear = this.clear.bind(this);\n this.append = this.append.bind(this);\n }\n\n /**\n * Append a file to the tar archive\n * @param filepath\n * @param input\n * @param [opts]\n */\n // eslint-disable-next-line complexity\n append(filepath: string, input: string | Uint8Array, opts?: TarOptions | undefined) {\n let checksum: string | any;\n\n if (typeof input === 'string') {\n input = stringToUint8(input);\n } else if (input.constructor && input.constructor !== Uint8Array.prototype.constructor) {\n // @ts-ignore\n const errorInputMatch = /function\\s*([$A-Za-z_][0-9A-Za-z_]*)\\s*\\(/.exec(\n input.constructor.toString()\n );\n const errorInput = errorInputMatch && errorInputMatch[1];\n const errorMessage = `Invalid input type. You gave me: ${errorInput}`;\n throw errorMessage;\n }\n\n opts = opts || {};\n\n const mode = opts.mode || parseInt('777', 8) & 0xfff;\n const mtime = opts.mtime || Math.floor(Number(new Date()) / 1000);\n const uid = opts.uid || 0;\n const gid = opts.gid || 0;\n\n const data: Record<string, string> = {\n fileName: filepath,\n fileMode: pad(mode, 7),\n uid: pad(uid, 7),\n gid: pad(gid, 7),\n fileSize: pad(input.length, 11),\n mtime: pad(mtime, 11),\n checksum: ' ',\n // 0 = just a file\n type: '0',\n ustar: 'ustar ',\n owner: opts.owner || '',\n group: opts.group || ''\n };\n\n // calculate the checksum\n checksum = 0;\n Object.keys(data).forEach((key) => {\n let i: number;\n const value = data[key];\n let length: number;\n\n for (i = 0, length = value.length; i < length; i += 1) {\n checksum += value.charCodeAt(i);\n }\n });\n\n data.checksum = `${pad(checksum, 6)}\\u0000 `;\n\n const headerArr = format(data);\n\n headerLength = Math.ceil(headerArr.length / recordSize) * recordSize;\n inputLength = Math.ceil(input.length / recordSize) * recordSize;\n\n this.blocks.push({\n header: headerArr,\n input,\n headerLength,\n inputLength\n });\n }\n /**\n * Compiling data to a Blob object\n * @returns {Blob}\n */\n save(): Blob {\n const buffers: any = [];\n const chunks = new Array<TarChunks>();\n let length = 0;\n const max = Math.pow(2, 20);\n\n let chunk = new Array<TarChunk>();\n this.blocks.forEach((b: any = []) => {\n if (length + b.headerLength + b.inputLength > max) {\n chunks.push({blocks: chunk, length});\n chunk = [];\n length = 0;\n }\n chunk.push(b);\n length += b.headerLength + b.inputLength;\n });\n chunks.push({blocks: chunk, length});\n\n chunks.forEach((c: any = []) => {\n const buffer = new Uint8Array(c.length);\n let written = 0;\n c.blocks.forEach((b: any = []) => {\n buffer.set(b.header, written);\n written += b.headerLength;\n buffer.set(b.input, written);\n written += b.inputLength;\n });\n buffers.push(buffer);\n });\n\n buffers.push(new Uint8Array(2 * recordSize));\n\n return new Blob(buffers, {type: 'octet/stream'});\n }\n /**\n * Clear the data by its blocksize\n */\n clear() {\n this.written = 0;\n this.out = clean(blockSize);\n }\n}\n\nexport default Tar;\n"],"mappings":";AAOA,SAAQA,KAAK,EAAEC,GAAG,EAAEC,aAAa,QAAO,SAAS;AACjD,SAAQC,MAAM,QAAO,UAAU;AAG/B,IAAIC,SAAiB;AACrB,IAAIC,YAAoB;AACxB,IAAIC,WAAmB;AAEvB,MAAMC,UAAU,GAAG,GAAG;AAEtB,MAAMC,GAAG,CAAC;EASRC,WAAWA,CAACC,eAAmC,EAAE;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA,iBAN7B,EAAE;IAAAA,eAAA;IAOpB,IAAI,CAACC,OAAO,GAAG,CAAC;IAChBR,SAAS,GAAG,CAACM,eAAe,IAAI,EAAE,IAAIH,UAAU;IAChD,IAAI,CAACM,GAAG,GAAGb,KAAK,CAACI,SAAS,CAAC;IAE3B,IAAI,CAACU,MAAM,GAAG,EAAE;IAChB,IAAI,CAACC,MAAM,GAAG,CAAC;IACf,IAAI,CAACC,IAAI,GAAG,IAAI,CAACA,IAAI,CAACC,IAAI,CAAC,IAAI,CAAC;IAChC,IAAI,CAACC,KAAK,GAAG,IAAI,CAACA,KAAK,CAACD,IAAI,CAAC,IAAI,CAAC;IAClC,IAAI,CAACE,MAAM,GAAG,IAAI,CAACA,MAAM,CAACF,IAAI,CAAC,IAAI,CAAC;EACtC;EASAE,MAAMA,CAACC,QAAgB,EAAEC,KAA0B,EAAEC,IAA6B,EAAE;IAClF,I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O,IAAIsD,CAAC,CAAC7D,YAAY;QACzBiE,MAAM,CAACC,GAAG,CAACL,CAAC,CAAC7C,KAAK,EAAET,OAAO,CAAC;QAC5BA,OAAO,IAAIsD,CAAC,CAAC5D,WAAW;MAC1B,CAAC,CAAC;MACFsD,OAAO,CAACF,IAAI,CAACY,MAAM,CAAC;IACtB,CAAC,CAAC;IAEFV,OAAO,CAACF,IAAI,CAAC,IAAIlC,UAAU,CAAC,CAAC,GAAGjB,UAAU,CAAC,CAAC;IAE5C,OAAO,IAAIiE,IAAI,CAACZ,OAAO,EAAE;MAACf,IAAI,EAAE;IAAc,CAAC,CAAC;EAClD;EAIA3B,KAAKA,CAAA,EAAG;IACN,IAAI,CAACN,OAAO,GAAG,CAAC;IAChB,IAAI,CAACC,GAAG,GAAGb,KAAK,CAACI,SAAS,CAAC;EAC7B;AACF;AAEA,eAAeI,GAAG"}
@@ -1,4 +1,3 @@
1
-
2
1
  export function clean(length) {
3
2
  let i;
4
3
  const buffer = new Uint8Array(length);
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","names":["clean","length","i","buffer","Uint8Array","pad","num","bytes","base","numStr","toString","substr","stringToUint8","input","out","offset","charCodeAt"],"sources":["../../../../src/lib/tar/utils.ts"],"sourcesContent":["// This file is derived from the tar-js code base under MIT license\n// See https://github.com/beatgammit/tar-js/blob/master/LICENSE\n/*\n * tar-js\n * MIT (c) 2011 T. Jameson Little\n */\n/**\n * Returns the memory area specified by length\n * @param length\n * @returns {Uint8Array}\n */\nexport function clean(length: number): Uint8Array {\n let i: number;\n const buffer = new Uint8Array(length);\n for (i = 0; i < length; i += 1) {\n buffer[i] = 0;\n }\n return buffer;\n}\n/**\n * Converting data to a string\n * @param num\n * @param bytes\n * @param base\n * @returns string\n */\nexport function pad(num: number, bytes: number, base?: number): string {\n const numStr = num.toString(base || 8);\n return '000000000000'.substr(numStr.length + 12 - bytes) + numStr;\n}\n/**\n * Converting input to binary data\n * @param input\n * @param out\n * @param offset\n * @returns {Uint8Array}\n */\nexport function stringToUint8(input: string, out?: Uint8Array, offset?: number): Uint8Array {\n let i: number;\n let length: number;\n\n out = out || clean(input.length);\n\n offset = offset || 0;\n for (i = 0, length = input.length; i < length; i += 1) {\n out[offset] = input.charCodeAt(i);\n offset += 1;\n }\n\n return out;\n}\n"],"mappings":";AAWA,OAAO,SAASA,KAAK,CAACC,MAAc,EAAc;EAChD,IAAIC,CAAS;EACb,MAAMC,MAAM,GAAG,IAAIC,UAAU,CAACH,MAAM,CAAC;EACrC,KAAKC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGD,MAAM,EAAEC,CAAC,IAAI,CAAC,EAAE;IAC9BC,MAAM,CAACD,CAAC,CAAC,GAAG,CAAC;EACf;EACA,OAAOC,MAAM;AACf;AAQA,OAAO,SAASE,GAAG,CAACC,GAAW,EAAEC,KAAa,EAAEC,IAAa,EAAU;EACrE,MAAMC,MAAM,GAAGH,GAAG,CAACI,QAAQ,CAACF,IAAI,IAAI,CAAC,CAAC;EACtC,OAAO,cAAc,CAACG,MAAM,CAACF,MAAM,CAACR,MAAM,GAAG,EAAE,GAAGM,KAAK,CAAC,GAAGE,MAAM;AACnE;AAQA,OAAO,SAASG,aAAa,CAACC,KAAa,EAAEC,GAAgB,EAAEC,MAAe,EAAc;EAC1F,IAAIb,CAAS;EACb,IAAID,MAAc;EAElBa,GAAG,GAAGA,GAAG,IAAId,KAAK,CAACa,KAAK,CAACZ,MAAM,CAAC;EAEhCc,MAAM,GAAGA,MAAM,IAAI,CAAC;EACpB,KAAKb,CAAC,GAAG,CAAC,EAAED,MAAM,GAAGY,KAAK,CAACZ,MAAM,EAAEC,CAAC,GAAGD,MAAM,EAAEC,CAAC,IAAI,CAAC,EAAE;IACrDY,GAAG,CAACC,MAAM,CAAC,GAAGF,KAAK,CAACG,UAAU,CAACd,CAAC,CAAC;IACjCa,MAAM,IAAI,CAAC;EACb;EAEA,OAAOD,GAAG;AACZ"}
1
+ {"version":3,"file":"utils.js","names":["clean","length","i","buffer","Uint8Array","pad","num","bytes","base","numStr","toString","substr","stringToUint8","input","out","offset","charCodeAt"],"sources":["../../../../src/lib/tar/utils.ts"],"sourcesContent":["// This file is derived from the tar-js code base under MIT license\n// See https://github.com/beatgammit/tar-js/blob/master/LICENSE\n/*\n * tar-js\n * MIT (c) 2011 T. Jameson Little\n */\n/**\n * Returns the memory area specified by length\n * @param length\n * @returns {Uint8Array}\n */\nexport function clean(length: number): Uint8Array {\n let i: number;\n const buffer = new Uint8Array(length);\n for (i = 0; i < length; i += 1) {\n buffer[i] = 0;\n }\n return buffer;\n}\n/**\n * Converting data to a string\n * @param num\n * @param bytes\n * @param base\n * @returns string\n */\nexport function pad(num: number, bytes: number, base?: number): string {\n const numStr = num.toString(base || 8);\n return '000000000000'.substr(numStr.length + 12 - bytes) + numStr;\n}\n/**\n * Converting input to binary data\n * @param input\n * @param out\n * @param offset\n * @returns {Uint8Array}\n */\nexport function stringToUint8(input: string, out?: Uint8Array, offset?: number): Uint8Array {\n let i: number;\n let length: number;\n\n out = out || clean(input.length);\n\n offset = offset || 0;\n for (i = 0, length = input.length; i < length; i += 1) {\n out[offset] = input.charCodeAt(i);\n offset += 1;\n }\n\n return out;\n}\n"],"mappings":"AAWA,OAAO,SAASA,KAAKA,CAACC,MAAc,EAAc;EAChD,IAAIC,CAAS;EACb,MAAMC,MAAM,GAAG,IAAIC,UAAU,CAACH,MAAM,CAAC;EACrC,KAAKC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGD,MAAM,EAAEC,CAAC,IAAI,CAAC,EAAE;IAC9BC,MAAM,CAACD,CAAC,CAAC,GAAG,CAAC;EACf;EACA,OAAOC,MAAM;AACf;AAQA,OAAO,SAASE,GAAGA,CAACC,GAAW,EAAEC,KAAa,EAAEC,IAAa,EAAU;EACrE,MAAMC,MAAM,GAAGH,GAAG,CAACI,QAAQ,CAACF,IAAI,IAAI,CAAC,CAAC;EACtC,OAAO,cAAc,CAACG,MAAM,CAACF,MAAM,CAACR,MAAM,GAAG,EAAE,GAAGM,KAAK,CAAC,GAAGE,MAAM;AACnE;AAQA,OAAO,SAASG,aAAaA,CAACC,KAAa,EAAEC,GAAgB,EAAEC,MAAe,EAAc;EAC1F,IAAIb,CAAS;EACb,IAAID,MAAc;EAElBa,GAAG,GAAGA,GAAG,IAAId,KAAK,CAACa,KAAK,CAACZ,MAAM,CAAC;EAEhCc,MAAM,GAAGA,MAAM,IAAI,CAAC;EACpB,KAAKb,CAAC,GAAG,CAAC,EAAED,MAAM,GAAGY,KAAK,CAACZ,MAAM,EAAEC,CAAC,GAAGD,MAAM,EAAEC,CAAC,IAAI,CAAC,EAAE;IACrDY,GAAG,CAACC,MAAM,CAAC,GAAGF,KAAK,CAACG,UAAU,CAACd,CAAC,CAAC;IACjCa,MAAM,IAAI,CAAC;EACb;EAEA,OAAOD,GAAG;AACZ"}
@@ -1 +1 @@
1
- {"version":3,"file":"tar-builder.js","names":["Tar","TAR_BUILDER_OPTIONS","recordsPerBlock","TARBuilder","properties","id","name","extensions","mimeTypes","builder","options","constructor","tape","addFile","filename","buffer","append","Uint8Array","count","build","Response","save","arrayBuffer"],"sources":["../../src/tar-builder.ts"],"sourcesContent":["import Tar from './lib/tar/tar';\n\nconst TAR_BUILDER_OPTIONS = {\n recordsPerBlock: 20\n};\n\ntype TarBuilderOptions = {\n recordsPerBlock?: number;\n};\n\n/**\n * Build a tar file by adding files\n */\nexport default class TARBuilder {\n static get properties() {\n return {\n id: 'tar',\n name: 'TAR',\n extensions: ['tar'],\n mimeTypes: ['application/x-tar'],\n builder: TARBuilder,\n options: TAR_BUILDER_OPTIONS\n };\n }\n\n options: TarBuilderOptions;\n tape: Tar;\n count: number = 0;\n\n constructor(options?: Partial<TarBuilderOptions>) {\n this.options = {...TAR_BUILDER_OPTIONS, ...options};\n this.tape = new Tar(this.options.recordsPerBlock);\n }\n /** Adds a file to the archive. */\n addFile(filename: string, buffer: ArrayBuffer) {\n this.tape.append(filename, new Uint8Array(buffer));\n this.count++;\n }\n\n async build(): Promise<ArrayBuffer> {\n return new Response(this.tape.save()).arrayBuffer();\n }\n}\n"],"mappings":";AAAA,OAAOA,GAAG,MAAM,eAAe;AAE/B,MAAMC,mBAAmB,GAAG;EAC1BC,eAAe,EAAE;AACnB,CAAC;AASD,eAAe,MAAMC,UAAU,CAAC;EAC9B,WAAWC,UAAU,GAAG;IACtB,OAAO;MACLC,EAAE,EAAE,KAAK;MACTC,IAAI,EAAE,KAAK;MACXC,UAAU,EAAE,CAAC,KAAK,CAAC;MACnBC,SAAS,EAAE,CAAC,mBAAmB,CAAC;MAChCC,OAAO,EAAEN,UAAU;MACnBO,OAAO,EAAET;IACX,CAAC;EACH;EAMAU,WAAW,CAACD,OAAoC,EAAE;IAAA;IAAA;IAAA,+BAFlC,CAAC;IAGf,IAAI,CAACA,OAAO,GAAG;MAAC,GAAGT,mBAAmB;MAAE,GAAGS;IAAO,CAAC;IACnD,IAAI,CAACE,IAAI,GAAG,IAAIZ,GAAG,CAAC,IAAI,CAACU,OAAO,CAACR,eAAe,CAAC;EACnD;EAEAW,OAAO,CAACC,QAAgB,EAAEC,MAAmB,EAAE;IAC7C,IAAI,CAACH,IAAI,CAACI,MAAM,CAACF,QAAQ,EAAE,IAAIG,UAAU,CAACF,MAAM,CAAC,CAAC;IAClD,IAAI,CAACG,KAAK,EAAE;EACd;EAEA,MAAMC,KAAK,GAAyB;IAClC,OAAO,IAAIC,QAAQ,CAAC,IAAI,CAACR,IAAI,CAACS,IAAI,EAAE,CAAC,CAACC,WAAW,EAAE;EACrD;AACF"}
1
+ {"version":3,"file":"tar-builder.js","names":["Tar","TAR_BUILDER_OPTIONS","recordsPerBlock","TARBuilder","properties","id","name","extensions","mimeTypes","builder","options","constructor","_defineProperty","tape","addFile","filename","buffer","append","Uint8Array","count","build","Response","save","arrayBuffer"],"sources":["../../src/tar-builder.ts"],"sourcesContent":["import Tar from './lib/tar/tar';\n\nconst TAR_BUILDER_OPTIONS = {\n recordsPerBlock: 20\n};\n\ntype TarBuilderOptions = {\n recordsPerBlock?: number;\n};\n\n/**\n * Build a tar file by adding files\n */\nexport default class TARBuilder {\n static get properties() {\n return {\n id: 'tar',\n name: 'TAR',\n extensions: ['tar'],\n mimeTypes: ['application/x-tar'],\n builder: TARBuilder,\n options: TAR_BUILDER_OPTIONS\n };\n }\n\n options: TarBuilderOptions;\n tape: Tar;\n count: number = 0;\n\n constructor(options?: Partial<TarBuilderOptions>) {\n this.options = {...TAR_BUILDER_OPTIONS, ...options};\n this.tape = new Tar(this.options.recordsPerBlock);\n }\n /** Adds a file to the archive. */\n addFile(filename: string, buffer: ArrayBuffer) {\n this.tape.append(filename, new Uint8Array(buffer));\n this.count++;\n }\n\n async build(): Promise<ArrayBuffer> {\n return new Response(this.tape.save()).arrayBuffer();\n }\n}\n"],"mappings":";AAAA,OAAOA,GAAG,MAAM,eAAe;AAE/B,MAAMC,mBAAmB,GAAG;EAC1BC,eAAe,EAAE;AACnB,CAAC;AASD,eAAe,MAAMC,UAAU,CAAC;EAC9B,WAAWC,UAAUA,CAAA,EAAG;IACtB,OAAO;MACLC,EAAE,EAAE,KAAK;MACTC,IAAI,EAAE,KAAK;MACXC,UAAU,EAAE,CAAC,KAAK,CAAC;MACnBC,SAAS,EAAE,CAAC,mBAAmB,CAAC;MAChCC,OAAO,EAAEN,UAAU;MACnBO,OAAO,EAAET;IACX,CAAC;EACH;EAMAU,WAAWA,CAACD,OAAoC,EAAE;IAAAE,eAAA;IAAAA,eAAA;IAAAA,eAAA,gBAFlC,CAAC;IAGf,IAAI,CAACF,OAAO,GAAG;MAAC,GAAGT,mBAAmB;MAAE,GAAGS;IAAO,CAAC;IACnD,IAAI,CAACG,IAAI,GAAG,IAAIb,GAAG,CAAC,IAAI,CAACU,OAAO,CAACR,eAAe,CAAC;EACnD;EAEAY,OAAOA,CAACC,QAAgB,EAAEC,MAAmB,EAAE;IAC7C,IAAI,CAACH,IAAI,CAACI,MAAM,CAACF,QAAQ,EAAE,IAAIG,UAAU,CAACF,MAAM,CAAC,CAAC;IAClD,IAAI,CAACG,KAAK,EAAE;EACd;EAEA,MAAMC,KAAKA,CAAA,EAAyB;IAClC,OAAO,IAAIC,QAAQ,CAAC,IAAI,CAACR,IAAI,CAACS,IAAI,CAAC,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC;EACrD;AACF"}
@@ -1,8 +1,5 @@
1
-
2
-
3
1
  import JSZip from 'jszip';
4
-
5
- const VERSION = typeof "3.4.0-alpha.2" !== 'undefined' ? "3.4.0-alpha.2" : 'latest';
2
+ const VERSION = typeof "3.4.0-alpha.4" !== 'undefined' ? "3.4.0-alpha.4" : 'latest';
6
3
  export const ZipLoader = {
7
4
  id: 'zip',
8
5
  module: 'zip',
@@ -22,13 +19,11 @@ async function parseZipAsync(data) {
22
19
  try {
23
20
  const jsZip = new JSZip();
24
21
  const zip = await jsZip.loadAsync(data, options);
25
-
26
22
  zip.forEach((relativePath, zipEntry) => {
27
23
  const subFilename = zipEntry.name;
28
24
  const promise = loadZipEntry(jsZip, subFilename, options).then(arrayBufferOrError => {
29
25
  fileMap[relativePath] = arrayBufferOrError;
30
26
  });
31
-
32
27
  promises.push(promise);
33
28
  });
34
29
  await Promise.all(promises);
@@ -1 +1 @@
1
- {"version":3,"file":"zip-loader.js","names":["JSZip","VERSION","ZipLoader","id","module","name","version","extensions","mimeTypes","category","tests","options","parse","parseZipAsync","data","promises","fileMap","jsZip","zip","loadAsync","forEach","relativePath","zipEntry","subFilename","promise","loadZipEntry","then","arrayBufferOrError","push","Promise","all","error","log","arrayBuffer","file","async","dataType","_typecheckZipLoader"],"sources":["../../src/zip-loader.ts"],"sourcesContent":["// Zip loader\nimport type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport JSZip from 'jszip';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport const ZipLoader = {\n id: 'zip',\n module: 'zip',\n name: 'Zip Archive',\n version: VERSION,\n extensions: ['zip'],\n mimeTypes: ['application/zip'],\n category: 'archive',\n tests: ['PK'],\n options: {},\n parse: parseZipAsync\n};\n\ntype FileMap = Record<string, ArrayBuffer>;\n\n// TODO - Could return a map of promises, perhaps as an option...\nasync function parseZipAsync(data: any, options = {}): Promise<FileMap> {\n const promises: Promise<any>[] = [];\n const fileMap: Record<string, ArrayBuffer> = {};\n\n try {\n const jsZip = new JSZip();\n\n const zip = await jsZip.loadAsync(data, options);\n\n // start to load each file in this zip\n zip.forEach((relativePath, zipEntry) => {\n const subFilename = zipEntry.name;\n\n const promise = loadZipEntry(jsZip, subFilename, options).then((arrayBufferOrError) => {\n fileMap[relativePath] = arrayBufferOrError;\n });\n\n // Ensure Promise.all doesn't ignore rejected promises.\n promises.push(promise);\n });\n\n await Promise.all(promises);\n return fileMap;\n } catch (error) {\n // @ts-ignore\n options.log.error(`Unable to read zip archive: ${error}`);\n throw error;\n }\n}\n\nasync function loadZipEntry(jsZip: any, subFilename: string, options: any = {}) {\n // jszip supports both arraybuffer and text, the main loaders.gl types\n // https://stuk.github.io/jszip/documentation/api_zipobject/async.html\n try {\n const arrayBuffer = await jsZip.file(subFilename).async(options.dataType || 'arraybuffer');\n return arrayBuffer;\n } catch (error) {\n options.log.error(`Unable to read ${subFilename} from zip archive: ${error}`);\n // Store error in place of data in map\n return error;\n }\n}\n\nexport const _typecheckZipLoader: LoaderWithParser = ZipLoader;\n"],"mappings":";;AAEA,OAAOA,KAAK,MAAM,OAAO;;AAIzB,MAAMC,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,QAAQ;AAE3E,OAAO,MAAMC,SAAS,GAAG;EACvBC,EAAE,EAAE,KAAK;EACTC,MAAM,EAAE,KAAK;EACbC,IAAI,EAAE,aAAa;EACnBC,OAAO,EAAEL,OAAO;EAChBM,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,SAAS,EAAE,CAAC,iBAAiB,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AAW;EACpB,CAAC,CAAC,OAAOF,KAAK,EAAE;IACdpB,OAAO,CAACqB,GAAG,CAACD,KAAK,0BAAmBR,WAAW,gCAAsBQ,KAAK,EAAG;IAE7E,OAAOA,KAAK;EACd;AACF;AAEA,OAAO,MAAMM,mBAAqC,GAAGnC,SAAS"}
1
+ {"version":3,"file":"zip-loader.js","names":["JSZip","VERSION","ZipLoader","id","module","name","version","extensions","mimeTypes","category","tests","options","parse","parseZipAsync","data","arguments","length","undefined","promises","fileMap","jsZip","zip","loadAsync","forEach","relativePath","zipEntry","subFilename","promise","loadZipEntry","then","arrayBufferOrError","push","Promise","all","error","log","concat","arrayBuffer","file","async","dataType","_typecheckZipLoader"],"sources":["../../src/zip-loader.ts"],"sourcesContent":["// Zip loader\nimport type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport JSZip from 'jszip';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport const ZipLoader = {\n id: 'zip',\n module: 'zip',\n name: 'Zip Archive',\n version: VERSION,\n extensions: ['zip'],\n mimeTypes: ['application/zip'],\n category: 'archive',\n tests: ['PK'],\n options: {},\n parse: parseZipAsync\n};\n\ntype FileMap = Record<string, ArrayBuffer>;\n\n// TODO - Could return a map of promises, perhaps as an option...\nasync function parseZipAsync(data: any, options = {}): Promise<FileMap> {\n const promises: Promise<any>[] = [];\n const fileMap: Record<string, ArrayBuffer> = {};\n\n try {\n const jsZip = new JSZip();\n\n const zip = await jsZip.loadAsync(data, options);\n\n // start to load each file in this zip\n zip.forEach((relativePath, zipEntry) => {\n const subFilename = zipEntry.name;\n\n const promise = loadZipEntry(jsZip, subFilename, options).then((arrayBufferOrError) => {\n fileMap[relativePath] = arrayBufferOrError;\n });\n\n // Ensure Promise.all doesn't ignore rejected promises.\n promises.push(promise);\n });\n\n await Promise.all(promises);\n return fileMap;\n } catch (error) {\n // @ts-ignore\n options.log.error(`Unable to read zip archive: ${error}`);\n throw error;\n }\n}\n\nasync function loadZipEntry(jsZip: any, subFilename: string, options: any = {}) {\n // jszip supports both arraybuffer and text, the main loaders.gl types\n // https://stuk.github.io/jszip/documentation/api_zipobject/async.html\n try {\n const arrayBuffer = await jsZip.file(subFilename).async(options.dataType || 'arraybuffer');\n return arrayBuffer;\n } catch (error) {\n options.log.error(`Unable to read ${subFilename} from zip archive: ${error}`);\n // Store error in place of data in map\n return error;\n }\n}\n\nexport const _typecheckZipLoader: LoaderWithParser = ZipLoader;\n"],"mappings":"AAEA,OAAOA,KAAK,MAAM,OAAO;AAIzB,MAAMC,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,QAAQ;AAE3E,OAAO,MAAMC,SAAS,GAAG;EACvBC,EAAE,EAAE,KAAK;EACTC,MAAM,EAAE,KAAK;EACbC,IAAI,EAAE,aAAa;EACnBC,OAAO,EAAEL,OAAO;EAChBM,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,SAAS,EAAE,CAAC,iBAAiB,CAAC;EAC9BC,QAAQ,EAAE,SAAS;EACnBC,KAAK,EAAE,CAAC,IAAI,CAAC;EACbC,OAAO,EAAE,CAAC,CAAC;EACXC,KAAK,EAAEC;AACT,CAAC;AAKD,eAAeA,aAAaA,CAACC,IAAS,EAAkC;EAAA,IAAhCH,OAAO,GAAAI,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAClD,MAAMG,QAAwB,GAAG,EAAE;EACnC,MAAMC,OAAoC,GAAG,CAAC,CAAC;EAE/C,IAAI;IACF,MAAMC,KAAK,GAAG,IAAIpB,KAAK,CAAC,CAAC;IAEzB,MAAMqB,GAAG,GAAG,MAAMD,KAAK,CAACE,SAAS,CAACR,IAAI,EAAEH,OAAO,CAAC;IAGhDU,GAAG,CAACE,OAAO,CAAC,CAACC,YAAY,EAAEC,QAAQ,KAAK;MACtC,MAAMC,WAAW,GAAGD,QAAQ,CAACpB,IAAI;MAEjC,MAAMsB,OAAO,GAAGC,YAAY,CAACR,KAAK,EAAEM,WAAW,EAAEf,OAAO,CAAC,CAACkB,IAAI,CAAEC,kBAAkB,IAAK;QACrFX,OAAO,CAACK,YAAY,CAAC,GAAGM,kBAAkB;MAC5C,CAAC,CAAC;MAGFZ,QAAQ,CAACa,IAAI,CAACJ,OAAO,CAAC;IACxB,CAAC,CAAC;IAEF,MAAMK,OAAO,CAACC,GAAG,CAACf,QAAQ,CAAC;IAC3B,OAAOC,OAAO;EAChB,CAAC,CAAC,OAAOe,KAAK,EAAE;IAEdvB,OAAO,CAACwB,GAAG,CAACD,KAAK,gCAAAE,MAAA,CAAgCF,KAAK,CAAE,CAAC;IACzD,MAAMA,KAAK;EACb;AACF;AAEA,eAAeN,YAAYA,CAACR,KAAU,EAAEM,WAAmB,EAAqB;EAAA,IAAnBf,OAAY,GAAAI,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAG5E,IAAI;IACF,MAAMsB,WAAW,GAAG,MAAMjB,KAAK,CAACkB,IAAI,CAACZ,WAAW,CAAC,CAACa,KAAK,CAAC5B,OAAO,CAAC6B,QAAQ,IAAI,aAAa,CAAC;IAC1F,OAAOH,WAAW;EACpB,CAAC,CAAC,OAAOH,KAAK,EAAE;IACdvB,OAAO,CAACwB,GAAG,CAACD,KAAK,mBAAAE,MAAA,CAAmBV,WAAW,yBAAAU,MAAA,CAAsBF,KAAK,CAAE,CAAC;IAE7E,OAAOA,KAAK;EACd;AACF;AAEA,OAAO,MAAMO,mBAAqC,GAAGvC,SAAS"}
@@ -1,5 +1,4 @@
1
1
  import JSZip from 'jszip';
2
-
3
2
  export const ZipWriter = {
4
3
  name: 'Zip Archive',
5
4
  extensions: ['zip'],
@@ -12,10 +11,8 @@ async function encodeZipAsync(fileMap) {
12
11
  const jsZip = new JSZip();
13
12
  for (const subFileName in fileMap) {
14
13
  const subFileData = fileMap[subFileName];
15
-
16
14
  jsZip.file(subFileName, subFileData, options);
17
15
  }
18
-
19
16
  options = Object.assign({}, options, {
20
17
  type: 'arraybuffer'
21
18
  });
@@ -1 +1 @@
1
- {"version":3,"file":"zip-writer.js","names":["JSZip","ZipWriter","name","extensions","category","mimeTypes","encode","encodeZipAsync","fileMap","options","jsZip","subFileName","subFileData","file","Object","assign","type","onUpdate","generateAsync","catch","error","log"],"sources":["../../src/zip-writer.ts"],"sourcesContent":["import type {Writer} from '@loaders.gl/loader-utils';\nimport JSZip from 'jszip';\n\n/**\n * Zip exporter\n */\nexport const ZipWriter: Writer = {\n name: 'Zip Archive',\n extensions: ['zip'],\n category: 'archive',\n mimeTypes: ['application/zip'],\n // @ts-ignore\n encode: encodeZipAsync\n};\n\nasync function encodeZipAsync(fileMap: any, options: any = {}) {\n const jsZip = new JSZip();\n // add files to the zip\n for (const subFileName in fileMap) {\n const subFileData = fileMap[subFileName];\n\n // jszip supports both arraybuffer and string data (the main loaders.gl types)\n // https://stuk.github.io/jszip/documentation/api_zipobject/async.html\n jsZip.file(subFileName, subFileData, options);\n }\n\n // always generate the full zip as an arraybuffer\n options = Object.assign({}, options, {\n type: 'arraybuffer'\n });\n const {onUpdate = () => {}} = options;\n\n return jsZip.generateAsync(options, onUpdate).catch((error) => {\n options.log.error(`Unable to write zip archive: ${error}`);\n throw error;\n });\n}\n"],"mappings":"AACA,OAAOA,KAAK,MAAM,OAAO;;AAKzB,OAAO,MAAMC,SAAiB,GAAG;EAC/BC,IAAI,EAAE,aAAa;EACnBC,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,QAAQ,EAAE,SAAS;EACnBC,SAAS,EAAE,CAAC,iBAAiB,CAAC;EAE9BC,MAAM,EAAEC;AACV,CAAC;AAED,eAAeA,cAAc,CAACC,OAAY,EAAqB;EAAA,IAAnBC,OAAY,uEAAG,CAAC,CAAC;EAC3D,MAAMC,KAAK,GAAG,IAAIV,KAAK,EAAE;EAEzB,KAAK,MAAMW,WAAW,IAAIH,OAAO,EAAE;IACjC,MAAMI,WAAW,GAAGJ,OAAO,CAACG,WAAW,CAAC;;IAIxCD,KAAK,CAACG,IAAI,CAACF,WAAW,EAAEC,WAAW,EAAEH,OAAO,CAAC;EAC/C;;EAGAA,OAAO,GAAGK,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,EAAEN,OAAO,EAAE;IACnCO,IAAI,EAAE;EACR,CAAC,CAAC;EACF,MAAM;IAACC,QAAQ,GAAG,MAAM,CAAC;EAAC,CAAC,GAAGR,OAAO;EAErC,OAAOC,KAAK,CAACQ,aAAa,CAACT,OAAO,EAAEQ,QAAQ,CAAC,CAACE,KAAK,CAAEC,KAAK,IAAK;IAC7DX,OAAO,CAACY,GAAG,CAACD,KAAK,wCAAiCA,KAAK,EAAG;IAC1D,MAAMA,KAAK;EACb,CAAC,CAAC;AACJ"}
1
+ {"version":3,"file":"zip-writer.js","names":["JSZip","ZipWriter","name","extensions","category","mimeTypes","encode","encodeZipAsync","fileMap","options","arguments","length","undefined","jsZip","subFileName","subFileData","file","Object","assign","type","onUpdate","generateAsync","catch","error","log","concat"],"sources":["../../src/zip-writer.ts"],"sourcesContent":["import type {Writer} from '@loaders.gl/loader-utils';\nimport JSZip from 'jszip';\n\n/**\n * Zip exporter\n */\nexport const ZipWriter: Writer = {\n name: 'Zip Archive',\n extensions: ['zip'],\n category: 'archive',\n mimeTypes: ['application/zip'],\n // @ts-ignore\n encode: encodeZipAsync\n};\n\nasync function encodeZipAsync(fileMap: any, options: any = {}) {\n const jsZip = new JSZip();\n // add files to the zip\n for (const subFileName in fileMap) {\n const subFileData = fileMap[subFileName];\n\n // jszip supports both arraybuffer and string data (the main loaders.gl types)\n // https://stuk.github.io/jszip/documentation/api_zipobject/async.html\n jsZip.file(subFileName, subFileData, options);\n }\n\n // always generate the full zip as an arraybuffer\n options = Object.assign({}, options, {\n type: 'arraybuffer'\n });\n const {onUpdate = () => {}} = options;\n\n return jsZip.generateAsync(options, onUpdate).catch((error) => {\n options.log.error(`Unable to write zip archive: ${error}`);\n throw error;\n });\n}\n"],"mappings":"AACA,OAAOA,KAAK,MAAM,OAAO;AAKzB,OAAO,MAAMC,SAAiB,GAAG;EAC/BC,IAAI,EAAE,aAAa;EACnBC,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,QAAQ,EAAE,SAAS;EACnBC,SAAS,EAAE,CAAC,iBAAiB,CAAC;EAE9BC,MAAM,EAAEC;AACV,CAAC;AAED,eAAeA,cAAcA,CAACC,OAAY,EAAqB;EAAA,IAAnBC,OAAY,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAC3D,MAAMG,KAAK,GAAG,IAAIb,KAAK,CAAC,CAAC;EAEzB,KAAK,MAAMc,WAAW,IAAIN,OAAO,EAAE;IACjC,MAAMO,WAAW,GAAGP,OAAO,CAACM,WAAW,CAAC;IAIxCD,KAAK,CAACG,IAAI,CAACF,WAAW,EAAEC,WAAW,EAAEN,OAAO,CAAC;EAC/C;EAGAA,OAAO,GAAGQ,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,EAAET,OAAO,EAAE;IACnCU,IAAI,EAAE;EACR,CAAC,CAAC;EACF,MAAM;IAACC,QAAQ,GAAGA,CAAA,KAAM,CAAC;EAAC,CAAC,GAAGX,OAAO;EAErC,OAAOI,KAAK,CAACQ,aAAa,CAACZ,OAAO,EAAEW,QAAQ,CAAC,CAACE,KAAK,CAAEC,KAAK,IAAK;IAC7Dd,OAAO,CAACe,GAAG,CAACD,KAAK,iCAAAE,MAAA,CAAiCF,KAAK,CAAE,CAAC;IAC1D,MAAMA,KAAK;EACb,CAAC,CAAC;AACJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/zip",
3
- "version": "3.4.0-alpha.2",
3
+ "version": "3.4.0-alpha.4",
4
4
  "description": "Zip Archive Loader",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -32,5 +32,5 @@
32
32
  "dependencies": {
33
33
  "jszip": "^3.1.5"
34
34
  },
35
- "gitHead": "f1c00c124d8d0c41a138ff40afb0d1a00711bf2e"
35
+ "gitHead": "f039a523df8b908a91f26c5ba8c4cfc1924b6140"
36
36
  }