How to use jszip

Comprehensive jszip code examples:

How to use jszip.prototype:

4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
// if the data is a base64 string, we decode it before checking the encoding !
if (this.options.base64) {
    result = base64.decode(result);
}
if (asUTF8 && this.options.binary) {
    // JSZip.prototype.utf8decode supports arrays as input
    // skip to array => string step, utf8decode will do it.
    result = out.utf8decode(result);
}
else {

How to use jszip.default:

793
794
795
796
797
798
799
800
801
802
803
804
    return deferred;
  }
});


exports.ExcelCreator = ExcelCreator;
ExcelCreator.JSZip = _jszip.default;


function getData(data, options) {
  // TODO: Looks like there is no need to export ExcelCreator any more?
  var excelCreator = new ExcelCreator(data, options);

How to use jszip.utils:

5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
    return result;
};


/**
 * Return the type of the input.
 * The type will be in a format valid for JSZip.utils.transformTo : string, array, uint8array, arraybuffer.
 * @param {Object} input the input to identify.
 * @return {String} the (lowercase) type of the input.
 */
exports.getTypeOf = function(input) {

How to use jszip.loadAsync:

173
174
175
176
177
178
179
180
181
182
}

const buffer = Buffer.from(JSON.parse(fs.readFileSync(`${__dirname}/admin-config/vsFont/codicon.json`)));

// this is workaround for TTF file. somehow it will always corrupt, so we pack it into ZIP
JSZip.loadAsync(buffer)
    .then(zip => {
        zip.file('codicon.ttf').async('arraybuffer')
            .then(data => {
                if (!fs.existsSync(`${__dirname}/admin/vs/base/browser/ui/codicons/codicon/`)) {