Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nexxkinn/littlezip
memory-friendly basic zip compression, decompression, and single file extraction for deno framework
https://github.com/nexxkinn/littlezip
deno zip
Last synced: 3 months ago
JSON representation
memory-friendly basic zip compression, decompression, and single file extraction for deno framework
- Host: GitHub
- URL: https://github.com/nexxkinn/littlezip
- Owner: Nexxkinn
- Created: 2020-11-26T11:05:17.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-09-14T05:05:32.000Z (over 3 years ago)
- Last Synced: 2024-11-18T15:15:18.493Z (3 months ago)
- Topics: deno, zip
- Language: TypeScript
- Homepage: https://gitlab.com/Nexxkinn/littlezip
- Size: 24.4 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
![]()
littleZip### Features
- memory-friendly
- deflate compression by default
- use few depedencies ( pako and std/join )### Usage
```ts
import { get_entries, compress, create_zip, open_zip } from 'https://deno.land/x/[email protected]/mod.ts'// read-only single file extraction, currently under development.
const file = await Deno.open('test.zip');
for (const { filename, index, extract } of get_entries(file)) {
if(index == 100){ // or filename === 'test.jpg'
const file = await Deno.create('test.jpg');
const content = await extract();
file.writeSync(content);
break;
}
}// compress
const zip = await compress('test/','result.zip');// create a new zip
const zip = await create_zip('path/to/target.zip');
await zip.push(buff1,'file.txt');
await zip.push(buff2,'image.jpg');
await zip.close() // call this at the end// edit zip
const zip = await open_zip('path/to/target.zip');
console.log(zip.entries()) // ['test.txt']
await zip.insert(buff2,'filename.jpg'); // ['test.txt', 'filename.jpg'] // push or replace file content
await zip.remove('test.txt'); // ['filename.jpg']
await zip.close(); // call this at the end
```### Limitation
- No encryption support
- Optimised for simple use case
- No Zip64 support