MCPcopy
hub / github.com/gildas-lormeau/zip.js / test

Function test

tests/all/test-blob.js:11–31  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

9export { test };
10
11async function test() {
12 zip.configure({ chunkSize: 128 });
13 const blobWriter = new zip.BlobWriter("application/zip");
14 const zipWriter = new zip.ZipWriter(blobWriter);
15 const entry = await zipWriter.add(FILENAME, new zip.BlobReader(BLOB), { level: 3 });
16 if (entry.compressionMethod == 0x08) {
17 await zipWriter.close();
18 const zipReader = new zip.ZipReader(new zip.BlobReader(await blobWriter.getData()));
19 const entries = await zipReader.getEntries();
20 if (entries[0].compressionMethod == 0x08) {
21 const data = await entries[0].getData(new zip.BlobWriter(zip.getMimeType(entries[0].filename)));
22 await zipReader.close();
23 await zip.terminateWorkers();
24 if (TEXT_CONTENT != (await data.text())) {
25 throw new Error();
26 }
27 }
28 } else {
29 throw new Error();
30 }
31}

Callers

nothing calls this directly

Calls 6

addMethod · 0.95
closeMethod · 0.95
getDataMethod · 0.95
getEntriesMethod · 0.95
closeMethod · 0.95
getDataMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…