MCPcopy Index your code
hub / github.com/scriptscat/scriptcat / generateAsync

Method generateAsync

src/pkg/utils/jszip-x.ts:125–143  ·  view source on GitHub ↗
(options: JSZipGenerateOptions)

Source from the content-addressed store, hash-verified

123 generateAsync(options: JSZipGenerateOptions & { type: "arraybuffer" }): Promise<ArrayBuffer>;
124
125 async generateAsync(options: JSZipGenerateOptions): Promise<Blob | Uint8Array<ArrayBuffer> | ArrayBuffer> {
126 const method = getCompressionMethod(options);
127 const writer = new ZipWriter({
128 outputAs: options.type as ZipWriterOutput,
129 level: getLevel(options),
130 comment: options.comment || undefined,
131 });
132
133 for (const [path, file] of Object.entries(this.files)) {
134 await writer.add({
135 path,
136 data: file.getContent(),
137 method,
138 meta: { modifiedAt: file.date },
139 });
140 }
141
142 return writer.close() as Promise<Blob | Uint8Array<ArrayBuffer> | ArrayBuffer>;
143 }
144}
145
146export const createJSZip = () => {

Callers 4

CloudScriptPlanFunction · 0.80
createTestZipFunction · 0.80
requestExportMethod · 0.80
backupToCloudMethod · 0.80

Calls 6

getCompressionMethodFunction · 0.85
getLevelFunction · 0.85
entriesMethod · 0.80
addMethod · 0.80
getContentMethod · 0.80
closeMethod · 0.65

Tested by 1

createTestZipFunction · 0.64