https://github.com/aslilac/unz
A lightweight and portable library for reading ZIP archives
https://github.com/aslilac/unz
zip
Last synced: 8 months ago
JSON representation
A lightweight and portable library for reading ZIP archives
- Host: GitHub
- URL: https://github.com/aslilac/unz
- Owner: aslilac
- License: mpl-2.0
- Created: 2018-10-11T21:50:17.000Z (over 7 years ago)
- Default Branch: trunk
- Last Pushed: 2024-12-17T18:24:40.000Z (over 1 year ago)
- Last Synced: 2025-02-27T04:46:30.466Z (over 1 year ago)
- Language: TypeScript
- Homepage:
- Size: 2.33 MB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/funding.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# unz
A lightweight package for reading ZIP files, using native Web APIs like `ArrayBuffer` and `DecompressionStream`. It's lightweight (about 2KB compressed) and works in all modern browsers, Node, and Deno, without any dependencies.
## Usage
```javascript
import unz from "unz";
// Log the file name and the first 10 bytes of every file in the ZIP archive.
const archive = unz(await file.arrayBuffer());
for (const [fileName, archiveFile] of archive) {
console.log(fileName, new Uint8Array(await archiveFile.arrayBuffer(), 0, 10));
}
```