adm-zip
adm-zip copied to clipboard
feature request | streaming implementation
I have a server that will be receiving up to 50MB files. I'd like to avoid buffering this request for obvious reasons :)
example API:
aReadableStream
.pipe(admZip.parseStream)
.on('entry', function (entry) {
var fileName = entry.path;
var type = entry.type; // 'Directory' or 'File'
var size = entry.size;
if (type == 'File' && fileName === 'target.png') {
// capture the data for this one entry
entry.pipe(fs.createWriteStream('path/to/target.png'));
} else {
entry.discard();
}
});
It's on going. The new version will have readers and writers that can take any reader (string, buffer, file, socket) as input and you read from them the zipped/unzipped version. there is a new branch you can take a look at if you want. still some fixes to do and the initial api implementation.
nice.. also want that :)
Me three!! This would be insanely helpful.
I would love to see streaming functionality in this library as well. I am afraid that having to load files into memory is keeping me from using the module as it is.
@cthackers, have you had any movement on this?
me too waiting on it
+1
For anyone looking for streamable zipping and unzipping, yazl and yauzl have my recommendations!
Yazl (Zipping): https://www.npmjs.com/package/yazl Yauzl (Unzipping): https://www.npmjs.com/package/yauzl
Very clean and stable API.
To be fair, yauzl does not and will not supporting streaming: https://github.com/thejoshwolfe/yauzl/issues/12
Hmm. You're right. I didn't realize that, since the event based API lead my thoughts towards streams. From the author's comment, though, it seems that streaming in an unzipping library isn't such a good idea after all.
Thankfully, it also seems that yauzl is aware and efficient when it comes to buffering, so it may be our best choice in any case.
FWIW I stumbled upon this http://stackoverflow.com/questions/20107303/dynamically-create-and-stream-zip-to-client
Although it illustrate a solution that uses node-archiver (https://github.com/archiverjs/node-archiver), I hope that could help someone anyhow.
streaming unzip is fundamentally flawed. streaming zip works fine.
Currently, yazl supports creating archive from streams.
It is a very niche usecase but when you need it, you need it.