Socket
Socket
Sign inDemoInstall

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.0-rc6 to 0.9.0-rc8

24

lib/Open/index.js

@@ -51,4 +51,28 @@ var fs = require('fs');

return directory(source);
},
s3 : function(client,params) {
var source = {
size: function() {
return new Promise(function(resolve,reject) {
client.headObject(params, function(err,d) {
if (err)
reject(err);
else
resolve(d.ContentLength);
});
});
},
stream: function(offset,length) {
var d = {};
for (var key in params)
d[key] = params[key];
d.Range = 'bytes='+offset+'-' + (length ? length : '');
return client.getObject(d).createReadStream();
}
};
return directory(source);
}
};

2

lib/parseOne.js

@@ -25,3 +25,3 @@ var Stream = require('stream');

found = true;
outStream.emit('entry',entry);
out.emit('entry',entry);
entry.on('error',function(e) {

@@ -28,0 +28,0 @@ outStream.emit('error',e);

{
"name": "unzipper",
"version": "0.9.0-rc6",
"version": "0.9.0-rc8",
"description": "Unzip cross-platform streaming API ",

@@ -37,2 +37,3 @@ "author": "Evan Oxfeld <eoxfeld@gmail.com>",

"devDependencies": {
"aws-sdk": "^2.77.0",
"request": "^2.79.0",

@@ -39,0 +40,0 @@ "tap": ">= 0.3.0 < 1",

@@ -64,3 +64,3 @@ # unzipper [![Build Status](https://api.travis-ci.org/ZJONSSON/node-unzipper.png)](https://api.travis-ci.org/ZJONSSON/node-unzipper)

objectMode: true,
_transform: function(entry,e,cb) {
transform: function(entry,e,cb) {
var fileName = entry.path;

@@ -185,3 +185,26 @@ var type = entry.type; // 'Directory' or 'File'

### Open.s3([aws-sdk], [params])
This function will return a Promise to the central directory information from a zipfile on S3. Range-headers are used to avoid reading the whole file. Unzipper does not ship with with the aws-sdk so you have to provide an instanciated client as first arguments. The params object requires `Bucket` and `Key` to fetch the correct file.
Example:
```js
var unzipper = require('./unzip');
var AWS = require('aws-sdk');
var s3Client = AWS.S3(config);
unzipper.Open.s3(s3Client,{Bucket: 'unzipper', Key: 'archive.zip'})
.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
See LICENCE

Sorry, the diff of this file is not supported yet

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