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

bloody-simple-s3

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bloody-simple-s3 - npm Package Compare versions

Comparing version 0.1.5 to 0.1.6

2

package.json
{
"name": "bloody-simple-s3",
"version": "0.1.5",
"version": "0.1.6",
"description": "A bloody simple interface to S3, based on the official AWS sdk.",

@@ -5,0 +5,0 @@ "repository": {

@@ -52,22 +52,22 @@ var path = require('path'),

* @return {ReadableStream}
* @throws {Error} if options are invalid.
*/
BloodySimpleS3.prototype.getObjectStream = function (options) {
var key, params;
var key;
// validate options
if (!_.isPlainObject(options)) {
return Promise.reject('Invalid request options, expected plain object, received ' + typeof(options));
throw new Error('Invalid request options, expected plain object, received ' + typeof(options));
}
// extract key from options + validate
key = options.key;
if (!_.isString(key)) {
return Promise.reject('Invalid object key, expected string, received ' + typeof(key));
throw new Error('Invalid object key, expected string, received ' + typeof(key));
}
params = _.extend(options, {
return this.s3.getObject({
Key: key,
Bucket: this.bucket
});
return this.s3.getObject(params).createReadStream();
}).createReadStream();
};

@@ -90,9 +90,18 @@

if (!_.isPlainObject(options)) return Promise.reject('Invalid request options, expected plain object, received ' + typeof(options));
// validate options
if (!_.isPlainObject(options)) {
reject('Invalid request options - expected plain object, received ' + typeof(options));
return;
}
// extract key from options + validate
key = options.key;
if (!_.isString(key)) {
reject('Invalid object key - expected string, received ' + typeof(key));
return;
}
destination = options.destination || os.tmpdir();
if (!_.isString(key)) return Promise.reject('Invalid object key, expected string, received ' + typeof(key));
// make sure destination is either file or folder
fs.stat(destination, function (err, stats) {

@@ -255,3 +264,5 @@ var target, writable, readable;

// s3.download('apk/lean-canvas.pdf').then(function (filePath) {
// s3.download({
// key: 'apk/com.canned.recipes_v1.apk'
// }).then(function (filePath) {
// console.log(filePath);

@@ -258,0 +269,0 @@ // }).catch(function (err) {

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