Skip to content

Commit 932da15

Browse files
committed
Proposed browser support change.
1 parent a8cf486 commit 932da15

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

examples/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
config.json
1+
config.json
2+
video.mp4

examples/upload.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ AWS.config.loadFromPath('./config.json');
1111
s3Stream.client(new AWS.S3());
1212

1313
// Create the streams
14-
var read = fs.createReadStream('path/to/file');
14+
var read = fs.createReadStream('./video.mp4');
1515
var compress = zlib.createGzip();
1616
var upload = new s3Stream.upload({
17-
"Bucket": "bucket-name",
18-
"Key": "key-name"
17+
"Bucket": "storydesk",
18+
"Key": "video.mp4.gz"
1919
});
2020

2121
// Handle errors.

lib/s3-upload-stream.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,10 @@ module.exports = {
122122
receivedBuffers.push(remainder);
123123
receivedBuffersLength = remainder.length;
124124

125-
// Return the original buffer.
126-
return combinedBuffer.slice(0, partSizeThreshold);
125+
// Return the perfectly sized part.
126+
var uploadBuffer = new Buffer(partSizeThreshold);
127+
combinedBuffer.copy(uploadBuffer, 0, 0, partSizeThreshold);
128+
return uploadBuffer;
127129
}
128130
else {
129131
// It just happened to be perfectly sized, so return it.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "s3-upload-stream",
33
"description": "Writeable stream for uploading content of unknown size to S3 via the multipart API.",
4-
"version": "1.0.4",
4+
"version": "1.0.5",
55
"author": {
66
"name": "Nathan Peck",
77
"email": "nathan@storydesk.com"

0 commit comments

Comments
 (0)