@node-projects/jszip 4.0.0

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.
package/lib/object.js ADDED
@@ -0,0 +1,375 @@
1
+ import utf8 from "./utf8.js";
2
+ import utils from "./utils.js";
3
+ import generate from "./generate/index.js";
4
+ import { GenericWorker } from "./stream/GenericWorker.js";
5
+ import { StreamHelper } from "./stream/StreamHelper.js";
6
+ import defaults from "./defaults.js";
7
+ import { ZipObject } from "./zipObject.js";
8
+ import nodejsUtils from "./nodejsUtils.js";
9
+ import { NodejsStreamInputAdapter } from "./nodejs/NodejsStreamInputAdapter.js";
10
+ import { CompressedObject } from "./compressedObject.js";
11
+
12
+ /**
13
+ * Add a file in the current folder.
14
+ * @private
15
+ * @param {string} name the name of the file
16
+ * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data of the file
17
+ * @param {Object} originalOptions the options of the file
18
+ * @return {Object} the new file.
19
+ */
20
+ var fileAdd = function (name, data, originalOptions) {
21
+ // be sure sub folders exist
22
+ var dataType = utils.getTypeOf(data),
23
+ parent;
24
+
25
+
26
+ /*
27
+ * Correct options.
28
+ */
29
+
30
+ var o = utils.extend(originalOptions || {}, defaults);
31
+ o.date = o.date || new Date();
32
+ if (o.compression !== null) {
33
+ o.compression = o.compression.toUpperCase();
34
+ }
35
+
36
+ if (typeof o.unixPermissions === "string") {
37
+ o.unixPermissions = parseInt(o.unixPermissions, 8);
38
+ }
39
+
40
+ // UNX_IFDIR 0040000 see zipinfo.c
41
+ if (o.unixPermissions && (o.unixPermissions & 0x4000)) {
42
+ o.dir = true;
43
+ }
44
+ // Bit 4 Directory
45
+ if (o.dosPermissions && (o.dosPermissions & 0x0010)) {
46
+ o.dir = true;
47
+ }
48
+
49
+ if (o.dir) {
50
+ name = forceTrailingSlash(name);
51
+ }
52
+ if (o.createFolders && (parent = parentFolder(name))) {
53
+ folderAdd.call(this, parent, true);
54
+ }
55
+
56
+ var isUnicodeString = dataType === "string" && o.binary === false && o.base64 === false;
57
+ if (!originalOptions || typeof originalOptions.binary === "undefined") {
58
+ o.binary = !isUnicodeString;
59
+ }
60
+
61
+
62
+ var isCompressedEmpty = (data instanceof CompressedObject) && data.uncompressedSize === 0;
63
+
64
+ if (isCompressedEmpty || o.dir || !data || data.length === 0) {
65
+ o.base64 = false;
66
+ o.binary = true;
67
+ data = "";
68
+ o.compression = "STORE";
69
+ dataType = "string";
70
+ }
71
+
72
+ /*
73
+ * Convert content to fit.
74
+ */
75
+
76
+ var zipObjectContent = null;
77
+ if (data instanceof CompressedObject || data instanceof GenericWorker) {
78
+ zipObjectContent = data;
79
+ } else if (nodejsUtils.isNode && nodejsUtils.isStream(data)) {
80
+ zipObjectContent = new NodejsStreamInputAdapter(name, data);
81
+ } else {
82
+ zipObjectContent = utils.prepareContent(name, data, o.binary, o.optimizedBinaryString, o.base64);
83
+ }
84
+
85
+ var object = new ZipObject(name, zipObjectContent, o);
86
+ this.files[name] = object;
87
+ /*
88
+ TODO: we can't throw an exception because we have async promises
89
+ (we can have a promise of a Date() for example) but returning a
90
+ promise is useless because file(name, data) returns the JSZip
91
+ object for chaining. Should we break that to allow the user
92
+ to catch the error ?
93
+
94
+ return external.Promise.resolve(zipObjectContent)
95
+ .then(function () {
96
+ return object;
97
+ });
98
+ */
99
+ };
100
+
101
+ /**
102
+ * Find the parent folder of the path.
103
+ * @private
104
+ * @param {string} path the path to use
105
+ * @return {string} the parent folder, or ""
106
+ */
107
+ var parentFolder = function (path) {
108
+ if (path.slice(-1) === "/") {
109
+ path = path.substring(0, path.length - 1);
110
+ }
111
+ var lastSlash = path.lastIndexOf("/");
112
+ return (lastSlash > 0) ? path.substring(0, lastSlash) : "";
113
+ };
114
+
115
+ /**
116
+ * Returns the path with a slash at the end.
117
+ * @private
118
+ * @param {String} path the path to check.
119
+ * @return {String} the path with a trailing slash.
120
+ */
121
+ var forceTrailingSlash = function (path) {
122
+ // Check the name ends with a /
123
+ if (path.slice(-1) !== "/") {
124
+ path += "/"; // IE doesn't like substr(-1)
125
+ }
126
+ return path;
127
+ };
128
+
129
+ /**
130
+ * Add a (sub) folder in the current folder.
131
+ * @private
132
+ * @param {string} name the folder's name
133
+ * @param {boolean=} [createFolders] If true, automatically create sub
134
+ * folders. Defaults to false.
135
+ * @return {Object} the new folder.
136
+ */
137
+ var folderAdd = function (name, createFolders) {
138
+ createFolders = (typeof createFolders !== "undefined") ? createFolders : defaults.createFolders;
139
+
140
+ name = forceTrailingSlash(name);
141
+
142
+ // Does this folder already exist?
143
+ if (!this.files[name]) {
144
+ fileAdd.call(this, name, null, {
145
+ dir: true,
146
+ createFolders: createFolders
147
+ });
148
+ }
149
+ return this.files[name];
150
+ };
151
+
152
+ /**
153
+ * Cross-window, cross-Node-context regular expression detection
154
+ * @param {Object} object Anything
155
+ * @return {Boolean} true if the object is a regular expression,
156
+ * false otherwise
157
+ */
158
+ function isRegExp(object) {
159
+ return Object.prototype.toString.call(object) === "[object RegExp]";
160
+ }
161
+
162
+ // return the actual prototype of JSZip
163
+ export default class JSZipPrototype {
164
+ /**
165
+ * Call a callback function for each entry at this folder level.
166
+ * @param {Function} cb the callback function:
167
+ * function (relativePath, file) {...}
168
+ * It takes 2 arguments : the relative path and the file.
169
+ */
170
+ forEach(cb) {
171
+ var filename, relativePath, file;
172
+ // ignore warning about unwanted properties because this.files is a null prototype object
173
+ /* eslint-disable-next-line guard-for-in */
174
+ for (filename in this.files) {
175
+ file = this.files[filename];
176
+ relativePath = filename.slice(this.root.length, filename.length);
177
+ if (relativePath && filename.slice(0, this.root.length) === this.root) { // the file is in the current root
178
+ cb(relativePath, file); // TODO reverse the parameters ? need to be clean AND consistent with the filter search fn...
179
+ }
180
+ }
181
+ }
182
+
183
+ /**
184
+ * Filter nested files/folders with the specified function.
185
+ * @param {Function} search the predicate to use :
186
+ * function (relativePath, file) {...}
187
+ * It takes 2 arguments : the relative path and the file.
188
+ * @return {Array} An array of matching elements.
189
+ */
190
+ filter(search) {
191
+ var result = [];
192
+ this.forEach(function (relativePath, entry) {
193
+ if (search(relativePath, entry)) { // the file matches the function
194
+ result.push(entry);
195
+ }
196
+
197
+ });
198
+ return result;
199
+ }
200
+
201
+ /**
202
+ * Add a file to the zip file, or search a file.
203
+ * @param {string|RegExp} name The name of the file to add (if data is defined),
204
+ * the name of the file to find (if no data) or a regex to match files.
205
+ * @param {String|ArrayBuffer|Uint8Array|Buffer} data The file data, either raw or base64 encoded
206
+ * @param {Object} o File options
207
+ * @return {JSZip|Object|Array} this JSZip object (when adding a file),
208
+ * a file (when searching by string) or an array of files (when searching by regex).
209
+ */
210
+ file(name, data, o) {
211
+ if (arguments.length === 1) {
212
+ if (isRegExp(name)) {
213
+ var regexp = name;
214
+ return this.filter(function (relativePath, file) {
215
+ return !file.dir && regexp.test(relativePath);
216
+ });
217
+ }
218
+ else { // text
219
+ var obj = this.files[this.root + name];
220
+ if (obj && !obj.dir) {
221
+ return obj;
222
+ } else {
223
+ return null;
224
+ }
225
+ }
226
+ }
227
+ else { // more than one argument : we have data !
228
+ name = this.root + name;
229
+ fileAdd.call(this, name, data, o);
230
+ }
231
+ return this;
232
+ }
233
+
234
+ /**
235
+ * Add a directory to the zip file, or search.
236
+ * @param {String|RegExp} arg The name of the directory to add, or a regex to search folders.
237
+ * @return {JSZip} an object with the new directory as the root, or an array containing matching folders.
238
+ */
239
+ folder(arg) {
240
+ if (!arg) {
241
+ return this;
242
+ }
243
+
244
+ if (isRegExp(arg)) {
245
+ return this.filter(function (relativePath, file) {
246
+ return file.dir && arg.test(relativePath);
247
+ });
248
+ }
249
+
250
+ // else, name is a new folder
251
+ var name = this.root + arg;
252
+ var newFolder = folderAdd.call(this, name);
253
+
254
+ // Allow chaining by returning a new object with this folder as the root
255
+ var ret = this.clone();
256
+ ret.root = newFolder.name;
257
+ return ret;
258
+ }
259
+
260
+ /**
261
+ * Delete a file, or a directory and all sub-files, from the zip
262
+ * @param {string} name the name of the file to delete
263
+ * @return {JSZip} this JSZip object
264
+ */
265
+ remove(name) {
266
+ name = this.root + name;
267
+ var file = this.files[name];
268
+ if (!file) {
269
+ // Look for any folders
270
+ if (name.slice(-1) !== "/") {
271
+ name += "/";
272
+ }
273
+ file = this.files[name];
274
+ }
275
+
276
+ if (file && !file.dir) {
277
+ // file
278
+ delete this.files[name];
279
+ } else {
280
+ // maybe a folder, delete recursively
281
+ var kids = this.filter(function (relativePath, file) {
282
+ return file.name.slice(0, name.length) === name;
283
+ });
284
+ for (var i = 0; i < kids.length; i++) {
285
+ delete this.files[kids[i].name];
286
+ }
287
+ }
288
+
289
+ return this;
290
+ }
291
+
292
+ /**
293
+ * @deprecated This method has been removed in JSZip 3.0, please check the upgrade guide.
294
+ */
295
+ generate() {
296
+ throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
297
+ }
298
+
299
+ /**
300
+ * Generate the complete zip file as an internal stream.
301
+ * @param {Object} options the options to generate the zip file :
302
+ * - compression, "STORE" by default.
303
+ * - type, "base64" by default. Values are : string, base64, uint8array, arraybuffer, blob.
304
+ * @return {StreamHelper} the streamed zip file.
305
+ */
306
+ generateInternalStream(options) {
307
+ var worker, opts = {};
308
+ try {
309
+ opts = utils.extend(options || {}, {
310
+ streamFiles: false,
311
+ compression: "STORE",
312
+ compressionOptions: null,
313
+ type: "",
314
+ platform: "DOS",
315
+ comment: null,
316
+ mimeType: "application/zip",
317
+ encodeFileName: utf8.utf8encode
318
+ });
319
+
320
+ opts.type = opts.type.toLowerCase();
321
+ opts.compression = opts.compression.toUpperCase();
322
+
323
+ // "binarystring" is preferred but the internals use "string".
324
+ if (opts.type === "binarystring") {
325
+ opts.type = "string";
326
+ }
327
+
328
+ if (!opts.type) {
329
+ throw new Error("No output type specified.");
330
+ }
331
+
332
+ utils.checkSupport(opts.type);
333
+
334
+ // accept nodejs `process.platform`
335
+ if (
336
+ opts.platform === "darwin" ||
337
+ opts.platform === "freebsd" ||
338
+ opts.platform === "linux" ||
339
+ opts.platform === "sunos"
340
+ ) {
341
+ opts.platform = "UNIX";
342
+ }
343
+ if (opts.platform === "win32") {
344
+ opts.platform = "DOS";
345
+ }
346
+
347
+ var comment = opts.comment || this.comment || "";
348
+ worker = generate.generateWorker(this, opts, comment);
349
+ } catch (e) {
350
+ worker = new GenericWorker("error");
351
+ worker.error(e);
352
+ }
353
+ return new StreamHelper(worker, opts.type || "string", opts.mimeType);
354
+ }
355
+
356
+ /**
357
+ * Generate the complete zip file asynchronously.
358
+ * @see generateInternalStream
359
+ */
360
+ generateAsync(options, onUpdate) {
361
+ return this.generateInternalStream(options).accumulate(onUpdate);
362
+ }
363
+
364
+ /**
365
+ * Generate the complete zip file asynchronously.
366
+ * @see generateInternalStream
367
+ */
368
+ generateNodeStream(options, onUpdate) {
369
+ options = options || {};
370
+ if (!options.type) {
371
+ options.type = "nodebuffer";
372
+ }
373
+ return this.generateInternalStream(options).toNodejsStream(onUpdate);
374
+ }
375
+ };
@@ -0,0 +1,59 @@
1
+ import { DataReader } from "./DataReader.js";
2
+
3
+ export class ArrayReader extends DataReader {
4
+ constructor(data) {
5
+ super(data);
6
+ for (var i = 0; i < this.data.length; i++) {
7
+ data[i] = data[i] & 0xFF;
8
+ }
9
+ }
10
+
11
+ /**
12
+ * @see DataReader.byteAt
13
+ */
14
+ byteAt(i) {
15
+ return this.data[this.zero + i];
16
+ }
17
+
18
+ /**
19
+ * @see DataReader.lastIndexOfSignature
20
+ */
21
+ lastIndexOfSignature(sig) {
22
+ var sig0 = sig.charCodeAt(0),
23
+ sig1 = sig.charCodeAt(1),
24
+ sig2 = sig.charCodeAt(2),
25
+ sig3 = sig.charCodeAt(3);
26
+ for (var i = this.length - 4; i >= 0; --i) {
27
+ if (this.data[i] === sig0 && this.data[i + 1] === sig1 && this.data[i + 2] === sig2 && this.data[i + 3] === sig3) {
28
+ return i - this.zero;
29
+ }
30
+ }
31
+
32
+ return -1;
33
+ }
34
+
35
+ /**
36
+ * @see DataReader.readAndCheckSignature
37
+ */
38
+ readAndCheckSignature(sig) {
39
+ var sig0 = sig.charCodeAt(0),
40
+ sig1 = sig.charCodeAt(1),
41
+ sig2 = sig.charCodeAt(2),
42
+ sig3 = sig.charCodeAt(3),
43
+ data = this.readData(4);
44
+ return sig0 === data[0] && sig1 === data[1] && sig2 === data[2] && sig3 === data[3];
45
+ }
46
+
47
+ /**
48
+ * @see DataReader.readData
49
+ */
50
+ readData(size) {
51
+ this.checkOffset(size);
52
+ if (size === 0) {
53
+ return [];
54
+ }
55
+ var result = this.data.slice(this.zero + this.index, this.zero + this.index + size);
56
+ this.index += size;
57
+ return result;
58
+ }
59
+ }
@@ -0,0 +1,125 @@
1
+ import { transformTo } from "../utils.js";
2
+
3
+ export class DataReader {
4
+ constructor(data) {
5
+ this.data = data; // type : see implementation
6
+ this.length = data.length;
7
+ this.index = 0;
8
+ this.zero = 0;
9
+ }
10
+
11
+ /**
12
+ * Check that the offset will not go too far.
13
+ * @param {string} offset the additional offset to check.
14
+ * @throws {Error} an Error if the offset is out of bounds.
15
+ */
16
+ checkOffset(offset) {
17
+ this.checkIndex(this.index + offset);
18
+ }
19
+
20
+ /**
21
+ * Check that the specified index will not be too far.
22
+ * @param {string} newIndex the index to check.
23
+ * @throws {Error} an Error if the index is out of bounds.
24
+ */
25
+ checkIndex(newIndex) {
26
+ if (this.length < this.zero + newIndex || newIndex < 0) {
27
+ throw new Error("End of data reached (data length = " + this.length + ", asked index = " + (newIndex) + "). Corrupted zip ?");
28
+ }
29
+ }
30
+
31
+ /**
32
+ * Change the index.
33
+ * @param {number} newIndex The new index.
34
+ * @throws {Error} if the new index is out of the data.
35
+ */
36
+ setIndex(newIndex) {
37
+ this.checkIndex(newIndex);
38
+ this.index = newIndex;
39
+ }
40
+
41
+ /**
42
+ * Skip the next n bytes.
43
+ * @param {number} n the number of bytes to skip.
44
+ * @throws {Error} if the new index is out of the data.
45
+ */
46
+ skip(n) {
47
+ this.setIndex(this.index + n);
48
+ }
49
+
50
+ /**
51
+ * Get the byte at the specified index.
52
+ * @param {number} i the index to use.
53
+ * @return {number} a byte.
54
+ */
55
+ byteAt() {
56
+ // see implementations
57
+ }
58
+
59
+ /**
60
+ * Get the next number with a given byte size.
61
+ * @param {number} size the number of bytes to read.
62
+ * @return {number} the corresponding number.
63
+ */
64
+ readInt(size) {
65
+ var result = 0,
66
+ i;
67
+ this.checkOffset(size);
68
+ for (i = this.index + size - 1; i >= this.index; i--) {
69
+ result = (result << 8) + this.byteAt(i);
70
+ }
71
+ this.index += size;
72
+ return result;
73
+ }
74
+
75
+ /**
76
+ * Get the next string with a given byte size.
77
+ * @param {number} size the number of bytes to read.
78
+ * @return {string} the corresponding string.
79
+ */
80
+ readString(size) {
81
+ return transformTo("string", this.readData(size));
82
+ }
83
+
84
+ /**
85
+ * Get raw data without conversion, <size> bytes.
86
+ * @param {number} size the number of bytes to read.
87
+ * @return {Object} the raw data, implementation specific.
88
+ */
89
+ readData() {
90
+ // see implementations
91
+ }
92
+
93
+ /**
94
+ * Find the last occurrence of a zip signature (4 bytes).
95
+ * @param {string} sig the signature to find.
96
+ * @return {number} the index of the last occurrence, -1 if not found.
97
+ */
98
+ lastIndexOfSignature() {
99
+ // see implementations
100
+ }
101
+
102
+ /**
103
+ * Read the signature (4 bytes) at the current position and compare it with sig.
104
+ * @param {string} sig the expected signature
105
+ * @return {boolean} true if the signature matches, false otherwise.
106
+ */
107
+ readAndCheckSignature() {
108
+ // see implementations
109
+ }
110
+
111
+ /**
112
+ * Get the next date.
113
+ * @return {Date} the date.
114
+ */
115
+ readDate() {
116
+ var dostime = this.readInt(4);
117
+ return new Date(Date.UTC(
118
+ ((dostime >> 25) & 0x7f) + 1980, // year
119
+ ((dostime >> 21) & 0x0f) - 1, // month
120
+ (dostime >> 16) & 0x1f, // day
121
+ (dostime >> 11) & 0x1f, // hour
122
+ (dostime >> 5) & 0x3f, // minute
123
+ (dostime & 0x1f) << 1)); // second
124
+ }
125
+ }
@@ -0,0 +1,17 @@
1
+ import { Uint8ArrayReader } from "./Uint8ArrayReader.js";
2
+
3
+ export class NodeBufferReader extends Uint8ArrayReader {
4
+ constructor(data) {
5
+ super(data);
6
+ }
7
+
8
+ /**
9
+ * @see DataReader.readData
10
+ */
11
+ readData(size) {
12
+ this.checkOffset(size);
13
+ var result = this.data.slice(this.zero + this.index, this.zero + this.index + size);
14
+ this.index += size;
15
+ return result;
16
+ }
17
+ }
@@ -0,0 +1,40 @@
1
+ import { DataReader } from "./DataReader.js";
2
+
3
+ export class StringReader extends DataReader {
4
+ constructor(data) {
5
+ super(data);
6
+ }
7
+
8
+ /**
9
+ * @see DataReader.byteAt
10
+ */
11
+ byteAt(i) {
12
+ return this.data.charCodeAt(this.zero + i);
13
+ }
14
+
15
+ /**
16
+ * @see DataReader.lastIndexOfSignature
17
+ */
18
+ lastIndexOfSignature(sig) {
19
+ return this.data.lastIndexOf(sig) - this.zero;
20
+ }
21
+
22
+ /**
23
+ * @see DataReader.readAndCheckSignature
24
+ */
25
+ readAndCheckSignature(sig) {
26
+ var data = this.readData(4);
27
+ return sig === data;
28
+ }
29
+
30
+ /**
31
+ * @see DataReader.readData
32
+ */
33
+ readData(size) {
34
+ this.checkOffset(size);
35
+ // this will work because the constructor applied the "& 0xff" mask.
36
+ var result = this.data.slice(this.zero + this.index, this.zero + this.index + size);
37
+ this.index += size;
38
+ return result;
39
+ }
40
+ }
@@ -0,0 +1,22 @@
1
+ import { ArrayReader } from "./ArrayReader.js";
2
+
3
+ export class Uint8ArrayReader extends ArrayReader {
4
+ constructor(data) {
5
+ super(data);
6
+ }
7
+
8
+ /**
9
+ * @see DataReader.readData
10
+ */
11
+
12
+ readData(size) {
13
+ this.checkOffset(size);
14
+ if (size === 0) {
15
+ // in IE10, when using subarray(idx, idx), we get the array [0x00] instead of [].
16
+ return new Uint8Array(0);
17
+ }
18
+ var result = this.data.subarray(this.zero + this.index, this.zero + this.index + size);
19
+ this.index += size;
20
+ return result;
21
+ }
22
+ }
@@ -0,0 +1,26 @@
1
+ import { getTypeOf, checkSupport, transformTo } from "../utils.js";
2
+ import support from "../support.js";
3
+ import { ArrayReader } from "./ArrayReader.js";
4
+ import { StringReader } from "./StringReader.js";
5
+ import { NodeBufferReader } from "./NodeBufferReader.js";
6
+ import { Uint8ArrayReader } from "./Uint8ArrayReader.js";
7
+
8
+ /**
9
+ * Create a reader adapted to the data.
10
+ * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data to read.
11
+ * @return {DataReader} the data reader.
12
+ */
13
+ export default function (data) {
14
+ var type = getTypeOf(data);
15
+ checkSupport(type);
16
+ if (type === "string" && !support.uint8array) {
17
+ return new StringReader(data);
18
+ }
19
+ if (type === "nodebuffer") {
20
+ return new NodeBufferReader(data);
21
+ }
22
+ if (support.uint8array) {
23
+ return new Uint8ArrayReader(transformTo("uint8array", data));
24
+ }
25
+ return new ArrayReader(transformTo("array", data));
26
+ };
@@ -0,0 +1,10 @@
1
+ export const LOCAL_FILE_HEADER = "PK\x03\x04";
2
+ export const CENTRAL_FILE_HEADER = "PK\x01\x02";
3
+ export const CENTRAL_DIRECTORY_END = "PK\x05\x06";
4
+ export const ZIP64_CENTRAL_DIRECTORY_LOCATOR = "PK\x06\x07";
5
+ export const ZIP64_CENTRAL_DIRECTORY_END = "PK\x06\x06";
6
+ export const DATA_DESCRIPTOR = "PK\x07\x08";
7
+
8
+ export default {
9
+ LOCAL_FILE_HEADER, CENTRAL_FILE_HEADER, CENTRAL_DIRECTORY_END, ZIP64_CENTRAL_DIRECTORY_LOCATOR, ZIP64_CENTRAL_DIRECTORY_END, DATA_DESCRIPTOR
10
+ }
@@ -0,0 +1,24 @@
1
+ import { GenericWorker } from "./GenericWorker.js";
2
+ import utils from "../utils.js";
3
+
4
+ export class ConvertWorker extends GenericWorker {
5
+ /**
6
+ * A worker which convert chunks to a specified type.
7
+ * @constructor
8
+ * @param {String} destType the destination type.
9
+ */
10
+ constructor(destType) {
11
+ super("ConvertWorker to " + destType);
12
+ this.destType = destType;
13
+ }
14
+
15
+ /**
16
+ * @see GenericWorker.processChunk
17
+ */
18
+ processChunk(chunk) {
19
+ this.push({
20
+ data: utils.transformTo(this.destType, chunk.data),
21
+ meta: chunk.meta
22
+ });
23
+ }
24
+ }