MCPcopy Create free account
hub / github.com/Stuk/jszip / transformZipOutput

Function transformZipOutput

lib/stream/StreamHelper.js:28–37  ·  view source on GitHub ↗

* Apply the final transformation of the data. If the user wants a Blob for * example, it's easier to work with an U8intArray and finally do the * ArrayBuffer/Blob conversion. * @param {String} type the name of the final type * @param {String|Uint8Array|Buffer} content the content to transform *

(type, content, mimeType)

Source from the content-addressed store, hash-verified

26 * @return {String|Uint8Array|ArrayBuffer|Buffer|Blob} the content in the right format.
27 */
28function transformZipOutput(type, content, mimeType) {
29 switch(type) {
30 case "blob" :
31 return utils.newBlob(utils.transformTo("arraybuffer", content), mimeType);
32 case "base64" :
33 return base64.encode(content);
34 default :
35 return utils.transformTo(type, content);
36 }
37}
38
39/**
40 * Concatenate an array of data of the given type.

Callers 1

accumulateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected