You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{get_entries,compress,create_zip,open_zip}from'https://deno.land/x/littlezip@0.4.0/mod.ts'// read-only single file extraction, currently under development.constfile=awaitDeno.open('test.zip');for(const{ filename, index, extract }ofget_entries(file)){if(index==100){// or filename === 'test.jpg'constfile=awaitDeno.create('test.jpg');constcontent=awaitextract();file.writeSync(content);break;}}// compressconstzip=awaitcompress('test/','result.zip');// create a new zipconstzip=awaitcreate_zip('path/to/target.zip');awaitzip.push(buff1,'file.txt');awaitzip.push(buff2,'image.jpg');awaitzip.close()// call this at the end// edit zipconstzip=awaitopen_zip('path/to/target.zip');console.log(zip.entries())// ['test.txt']awaitzip.insert(buff2,'filename.jpg');// ['test.txt', 'filename.jpg'] // push or replace file contentawaitzip.remove('test.txt');// ['filename.jpg']awaitzip.close();// call this at the end
Limitation
No encryption support
Optimised for simple use case
No Zip64 support
About
memory-friendly basic zip compression, decompression, and single file extraction for deno framework