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

knox

Package Overview
Dependencies
Maintainers
2
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

knox - npm Package Compare versions

Comparing version 0.4.1 to 0.4.2

40

lib/client.js

@@ -45,2 +45,6 @@ /*!

function removeLeadingSlash(filename) {
return filename[0] === '/' ? filename.substring(1) : filename;
}
function getContentLength(headers) {

@@ -449,3 +453,3 @@ for (var header in headers) {

}
var req = this.del(filename, headers)
var req = this.del(filename, headers);
registerReqListeners(req, fn);

@@ -456,13 +460,15 @@ req.end();

function xmlEscape(string) {
return string.replace(/&/g, "&")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;");
return string.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;');
}
function makeDeleteXmlString(keys) {
var tags = keys.map(function (key) {
return "<Object><Key>" + xmlEscape(key) + "</Key></Object>";
var tags = keys.map(function(key){
return '<Object><Key>' +
xmlEscape(removeLeadingSlash(key)) +
'</Key></Object>';
});
return "<Delete>" + tags.join("") + "</Delete>";
return '<Delete>' + tags.join('') + '</Delete>';
}

@@ -529,3 +535,4 @@

LastModified: Date,
Size: Number
Size: Number,
Contents: Array
};

@@ -547,6 +554,14 @@

data[key] = new Date(data[key]);
} else if (Constr === Array) {
// If there's only one element in the array xml2js doesn't know that
// it should be an array; array-ify it.
if (!Array.isArray(data[key])) {
data[key] = [data[key]];
}
} else {
data[key] = Constr(data[key]);
}
} else if (Array.isArray(data[key])) {
}
if (Array.isArray(data[key])) {
data[key].forEach(normalizeResponse);

@@ -601,2 +616,7 @@ }

normalizeResponse(data);
if (!('Contents' in data)) {
data.Contents = [];
}
fn(null, data);

@@ -603,0 +623,0 @@ });

@@ -5,3 +5,3 @@ {

"keywords": ["aws", "amazon", "s3"],
"version": "0.4.1",
"version": "0.4.2",
"author": "TJ Holowaychuk <tj@learnboost.com>",

@@ -8,0 +8,0 @@ "contributors": [

@@ -215,19 +215,2 @@ # knox

### Multipart Upload
S3's [multipart upload][] is their [rather-complicated][] way of uploading large
files. In particular, it is the only way of streaming files without knowing
their Content-Length ahead of time.
Adding the complexity of multipart upload directly to knox is not a great idea.
For example, it requires buffering at least 5 MiB of data at a time in memory,
which you want to avoid if possible. Fortunately, [@nathanoehlman][] has created
the excellent [knox-mpu][] package to let you use multipart upload with knox if
you need it!
[multipart upload]: aws.typepad.com/aws/2010/11/amazon-s3-multipart-upload.html
[rather-complicated]: http://stackoverflow.com/q/8653146/3191
[@nathanoehlman]: https://github.com/nathanoehlman
[knox-mpu]: https://npmjs.org/package/knox-mpu
## Client Creation Options

@@ -298,2 +281,31 @@

## Beyond Knox
### Multipart Upload
S3's [multipart upload][] is their [rather-complicated][] way of uploading large
files. In particular, it is the only way of streaming files without knowing
their Content-Length ahead of time.
Adding the complexity of multipart upload directly to knox is not a great idea.
For example, it requires buffering at least 5 MiB of data at a time in memory,
which you want to avoid if possible. Fortunately, [@nathanoehlman][] has created
the excellent [knox-mpu][] package to let you use multipart upload with knox if
you need it!
[multipart upload]: aws.typepad.com/aws/2010/11/amazon-s3-multipart-upload.html
[rather-complicated]: http://stackoverflow.com/q/8653146/3191
[@nathanoehlman]: https://github.com/nathanoehlman
[knox-mpu]: https://npmjs.org/package/knox-mpu
### Easy Download/Upload
[@superjoe30][] has created a nice library, called [s3-client][], that makes it
very easy to upload local files directly to S3, and download them back to your
filesystem. For simple cases this is often exactly what you want!
[@superjoe30]: https://github.com/superjoe30
[s3-client]: https://npmjs.org/package/s3-client
## Running Tests

@@ -300,0 +312,0 @@

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