Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

unzipper

Package Overview
Dependencies
Maintainers
1
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unzipper - npm Package Compare versions

Comparing version 0.9.1 to 0.9.2

18

lib/Open/index.js
var fs = require('fs');
var Promise = require('bluebird');
var directory = require('./directory');
var Stream = require('stream');
// Backwards compatibility for node versions < 8
if (!Stream.Writable || !Stream.Writable.prototype.destroy)
Stream = require('readable-stream');
module.exports = {
buffer: function(buffer) {
var source = {
stream: function(offset, length) {
var stream = Stream.PassThrough();
stream.end(buffer.slice(offset, length));
return stream;
},
size: function() {
return Promise.resolve(buffer.length);
}
};
return directory(source);
},
file: function(filename) {

@@ -7,0 +25,0 @@ var source = {

5

lib/parse.js

@@ -81,4 +81,6 @@ var util = require('util');

var entry = Stream.PassThrough();
var __autodraining = false;
entry.autodrain = function() {
__autodraining = true;
return new Promise(function(resolve,reject) {

@@ -133,3 +135,4 @@ entry.pipe(NoopStream());

var inflater = vars.compressionMethod ? zlib.createInflateRaw() : Stream.PassThrough();
entry.__autodraining = __autodraining; // expose __autodraining for test purposes
var inflater = (vars.compressionMethod && !__autodraining) ? zlib.createInflateRaw() : Stream.PassThrough();

@@ -136,0 +139,0 @@ if (fileSizeKnown) {

2

package.json
{
"name": "unzipper",
"version": "0.9.1",
"version": "0.9.2",
"description": "Unzip cross-platform streaming API ",

@@ -5,0 +5,0 @@ "author": "Evan Oxfeld <eoxfeld@gmail.com>",

@@ -228,4 +228,24 @@ # unzipper [![Build Status](https://api.travis-ci.org/ZJONSSON/node-unzipper.png)](https://travis-ci.org/ZJONSSON/node-unzipper.svg?branch=master)

### Open.buffer(buffer)
If you already have the zip file in-memory as a buffer, you can open the contents directly.
Example:
```js
// never use readFileSync - only used here to simplify the example
var buffer = fs.readFileSync('path/to/arhive.zip');
unzipper.Open.buffer(buffer)
.then(function(d) {
console.log('directory',d);
return new Promise(function(resolve,reject) {
d.files[0].stream()
.pipe(fs.createWriteStream('firstFile'))
.on('error',reject)
.on('finish',resolve)
});
});
```
## Licenses
See LICENCE
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc