0.1.1 • Published 8 months ago
@buh/unzip v0.1.1
unzip
Installation
npm install @buh/unzip
Quick Examples
Bun
Use inflateSync
from Bun.inflateSync
import { Zip } from '@buh/unzip';
const file = Bun.file('archive.zip');
const arrayBuffer = await file.arrayBuffer();
const zip = await Zip.create(arrayBuffer);
for (const entry of zip.iterator()) {
console.log(entry.fileName, entry.lastModified(), zip.textDecoder.decode(entry.getData()));
}
Node
Use inflateRawSync
from node:zlib
import { Zip } from '@buh/unzip';
import { readFileSync } from 'node:fs';
const file = readFileSync('archive.zip');
const zip = await Zip.create(file.buffer);
for (const entry of zip.iterator()) {
console.log(entry.fileName, entry.lastModified(), zip.textDecoder.decode(entry.getData()));
}
References
Chagelogs
You can track the changelogs in CHANGELOGS.md file.