Skip to content

Commit

Permalink
Fixing usage error in docs and examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanpeck committed Sep 26, 2014
1 parent 72fb52d commit eaae0fc
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 20 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
=========

#### 1.0.1 (2014-09-26)

Fixed error in usage in the documentation and examples. The examples did not use the "new" keyword when creating the upload stream, so there were scope issues when doing parallel uploads. This has been clarified and corrected in the documentation and examples.

#### 1.0.0 (2014-09-15)

Major overhaul of the functional interface. Breaks compatability with older versions of the module in favor of a cleaner, more streamlined approach. A migration guide for users of older versions of the module has been included in the documentation.
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ A pipeable write stream which uploads to Amazon S3 using the multipart file uplo

### Changelog

#### 1.0.0 (2014-09-15)
#### 1.0.1 (2014-09-26)

Major overhaul of the functional interface. Breaks compatability with older versions of the module in favor of a cleaner, more streamlined approach. A migration guide for users of older versions of the module has been included in the documentation.
Fixed error in usage in the documentation and examples. The examples did not use the "new" keyword when creating the upload stream, so there were scope issues when doing parallel uploads. This has been clarified and corrected in the documentation and examples.

#### 0.6.2 (2014-08-31)
#### 1.0.0 (2014-09-15)

Upgrading the AWS SDK dependency to the latest version. Fixes issue #11
Major overhaul of the functional interface. Breaks compatability with older versions of the module in favor of a cleaner, more streamlined approach. A migration guide for users of older versions of the module has been included in the documentation.

[Historical Changelogs](CHANGELOG.md)

Expand Down Expand Up @@ -44,7 +44,7 @@ s3Stream.client(new AWS.S3());
// Create the streams
var read = fs.createReadStream('/path/to/a/file');
var compress = zlib.createGzip();
var upload = s3Stream.upload({
var upload = new s3Stream.upload({
"Bucket": "bucket-name",
"Key": "key-name"
});
Expand Down Expand Up @@ -118,7 +118,7 @@ var s3Stream = require('s3-upload-stream'),
s3Stream.client(new AWS.S3());

var read = fs.createReadStream('/path/to/a/file');
var upload = s3Client.upload({
var upload = new s3Client.upload({
"Bucket": "bucket-name",
"Key": "key-name",
"ACL": "public-read",
Expand All @@ -144,7 +144,7 @@ var s3Stream = require('s3-upload-stream'),
s3Stream.client(new AWS.S3());

var read = fs.createReadStream('/path/to/a/file');
var upload = s3Client.upload({
var upload = new s3Client.upload({
"Bucket": "bucket-name",
"Key": "key-name"
});
Expand All @@ -167,7 +167,7 @@ var s3Stream = require('s3-upload-stream'),
s3Stream.client(new AWS.S3());

var read = fs.createReadStream('/path/to/a/file');
var upload = s3Client.upload({
var upload = new s3Client.upload({
"Bucket": "bucket-name",
"Key": "key-name"
});
Expand Down
2 changes: 1 addition & 1 deletion examples/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ s3Stream.client(new AWS.S3());
// Create the streams
var read = fs.createReadStream('../lib/s3-upload-stream.js');
var compress = zlib.createGzip();
var upload = s3Stream.upload({
var upload = new s3Stream.upload({
"Bucket": "bucket-name",
"Key": "key-name"
});
Expand Down
7 changes: 5 additions & 2 deletions lib/s3-upload-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = {
var e = new events.EventEmitter();

// Create the writeable stream interface.
self.ws = Writable({
self.ws = new Writable({
highWaterMark: 4194304 // 4 MB
});

Expand Down Expand Up @@ -210,8 +210,11 @@ module.exports = {
function (err, result) {
if (err)
self.abortUpload('Failed to complete the multipart upload on S3: ' + JSON.stringify(err));
else
else {
// Emit both events for backwards compatability, and to follow the spec.
self.ws.emit('uploaded', result);
self.ws.emit('finished', result);
}
}
);
};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "s3-upload-stream",
"description": "Writeable stream for uploading content of unknown size to S3 via the multipart API.",
"version": "1.0.0",
"version": "1.0.1",
"author": {
"name": "Nathan Peck",
"email": "nathan@storydesk.com"
Expand Down
16 changes: 8 additions & 8 deletions tests/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ describe('Creating upload stream', function () {

it('should throw an error', function (done) {
try {
uploadStream = s3Stream.upload({
uploadStream = new s3Stream.upload({
"Bucket": "test-bucket-name",
"Key": "test-file-name"
});
Expand All @@ -133,7 +133,7 @@ describe('Creating upload stream', function () {
before(function (done) {
s3Stream.client(new AWSstub.S3());

uploadStream = s3Stream.upload({
uploadStream = new s3Stream.upload({
"Bucket": "test-bucket-name",
"Key": "test-file-name"
});
Expand All @@ -155,7 +155,7 @@ describe('Stream Methods', function () {
var uploadStream;

before(function (done) {
uploadStream = s3Stream.upload({
uploadStream = new s3Stream.upload({
"Bucket": "test-bucket-name",
"Key": "test-file-name"
});
Expand Down Expand Up @@ -208,7 +208,7 @@ describe('Piping data into the writable upload stream', function () {
var uploadStream;

before(function (done) {
uploadStream = s3Stream.upload({
uploadStream = new s3Stream.upload({
"Bucket": "test-bucket-name",
"Key": "test-file-name"
});
Expand Down Expand Up @@ -264,7 +264,7 @@ describe('Piping data into the writable upload stream', function () {
describe('S3 Error catching', function () {
describe('Error creating multipart upload', function () {
it('should emit an error', function (done) {
var uploadStream = s3Stream.upload({
var uploadStream = new s3Stream.upload({
"Bucket": "test-bucket-name",
"Key": "create-fail"
});
Expand All @@ -279,7 +279,7 @@ describe('S3 Error catching', function () {
var uploadStream;

before(function (done) {
uploadStream = s3Stream.upload({
uploadStream = new s3Stream.upload({
"Bucket": "test-bucket-name",
"Key": "upload-fail"
});
Expand Down Expand Up @@ -308,7 +308,7 @@ describe('S3 Error catching', function () {
var uploadStream;

before(function (done) {
uploadStream = s3Stream.upload({
uploadStream = new s3Stream.upload({
"Bucket": "test-bucket-name",
"Key": "complete-fail"
});
Expand Down Expand Up @@ -337,7 +337,7 @@ describe('S3 Error catching', function () {
var uploadStream;

before(function (done) {
uploadStream = s3Stream.upload({
uploadStream = new s3Stream.upload({
"Bucket": "test-bucket-name",
"Key": "abort-fail"
});
Expand Down

0 comments on commit eaae0fc

Please sign in to comment.