Comparing version 0.3.0 to 0.3.1
@@ -29,3 +29,4 @@ var knox = require('knox') | ||
} else if (resp.statusCode === 200 || resp.statusCode === 307) { | ||
uploader.emit('end', resp.req.url); | ||
// sometimes resp.req is undefined. nobody knows why | ||
uploader.emit('end', resp.req ? resp.req.url : resp.url); | ||
} else { | ||
@@ -74,4 +75,6 @@ uploader.emit('error', new Error("s3 http status code " + resp.statusCode)); | ||
removeListeners(); | ||
writeStream.end(); | ||
downloader.emit('end', { headers: headers }); | ||
// make sure the stream has ended before we emit the event | ||
writeStream.end(null, null, function() { | ||
downloader.emit('end', { headers: headers }); | ||
}); | ||
} | ||
@@ -78,0 +81,0 @@ function onData(data) { |
{ | ||
"name": "s3", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "high level amazon s3 client using knox as a backend", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -10,2 +10,3 @@ Install: | ||
var s3 = require('s3'); | ||
// createClient allows any options that knox does. | ||
@@ -18,4 +19,10 @@ var client = s3.createClient({ | ||
// optional headers | ||
var headers = { | ||
'Content-Type' : 'image/jpg', | ||
'x-amz-acl' : 'public-read' | ||
}; | ||
// upload a file to s3 | ||
var uploader = client.upload("some/local/file", "some/remote/file"); | ||
var uploader = client.upload("some/local/file", "some/remote/file", headers); | ||
uploader.on('error', function(err) { | ||
@@ -56,1 +63,9 @@ console.error("unable to upload:", err.stack); | ||
`S3_KEY=<valid_s3_key> S3_SECRET=<valid_s3_secret> S3_BUCKET=<valid_s3_bucket> npm test` | ||
History: | ||
-------- | ||
### 0.3.1 | ||
* fix `resp.req.url` sometimes not defined causing crash | ||
* fix emitting `end` event before write completely finished |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4857
78
69