MCPcopy Index your code
hub / github.com/hoothin/UserScripts / transformZipOutput

Function transformZipOutput

Picviewer CE+/dist.user.js:2794–2803  ·  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

2792 * @return {String|Uint8Array|ArrayBuffer|Buffer|Blob} the content in the right format.
2793 */
2794function transformZipOutput(type, content, mimeType) {
2795 switch(type) {
2796 case "blob" :
2797 return utils.newBlob(utils.transformTo("arraybuffer", content), mimeType);
2798 case "base64" :
2799 return base64.encode(content);
2800 default :
2801 return utils.transformTo(type, content);
2802 }
2803}
2804
2805/**
2806 * Concatenate an array of data of the given type.

Callers 1

accumulateFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected