Permalink
Browse files

Small tweaks to stop jshint nags

  • Loading branch information...
1 parent b6a8f58 commit 84d4a75826897d5b7fffb5537841d8ea1dcab4f6 @DamonOehlman DamonOehlman committed Mar 1, 2013
Showing with 13 additions and 10 deletions.
  1. +3 −0 .jshintrc
  2. +10 −10 lib/multipartupload.js
View
@@ -0,0 +1,3 @@
+{
+ "indent": 4
+}
@@ -29,7 +29,7 @@ function MultiPartUpload(opts, callback) {
this.partSize = opts.partSize || 5242880; // 5MB default
this.uploadId = null;
this.uploads = new Batch();
-
+
if (opts.stream) {
this._putStream(opts.stream, callback);
} else {
@@ -59,7 +59,7 @@ MultiPartUpload.prototype._initiate = function(callback) {
});
req.end();
-}
+};
/**
* Streams a file to S3 using a multipart form upload
@@ -79,7 +79,7 @@ MultiPartUpload.prototype._putFile = function(file, callback) {
var stream = fs.createReadStream(file);
mpu._putStream(stream, callback);
});
-}
+};
/**
* Streams a stream to S3 using a multipart form upload.
@@ -101,7 +101,7 @@ MultiPartUpload.prototype._putStream = function(stream, callback) {
}
// Start handling the stream straight away
mpu._handleStream(stream, callback);
-}
+};
/**
Handles an incoming stream, divides it into parts, and uploads it to S3
@@ -129,7 +129,7 @@ MultiPartUpload.prototype._handleStream = function(stream, callback) {
}
function partReady(part) {
- if (!part) return
+ if (!part) return;
// Ensure the stream is closed
if (part.stream.writable) {
@@ -169,7 +169,7 @@ MultiPartUpload.prototype._handleStream = function(stream, callback) {
// Clean up
return callback(err);
});
-}
+};
/**
Uploads a part, or if we are not ready yet, waits for the upload to be initiated
@@ -179,7 +179,7 @@ MultiPartUpload.prototype._uploadPart = function(part, callback) {
// If we haven't started the upload yet, wait for the initialization
if (!this.uploadId) {
- return this.on('initiated', this._uploadPart.bind(this, part, callback));
+ return this.on('initiated', this._uploadPart.bind(this, part, callback));
}
var url = this.objectName + '?partNumber=' + part.id + '&uploadId=' + this.uploadId,
@@ -193,7 +193,7 @@ MultiPartUpload.prototype._uploadPart = function(part, callback) {
if (res.statusCode != 200) return callback({part: part.id, message: 'Upload failed'});
// Grab the etag and return it
- var etag = res.headers['etag'],
+ var etag = res.headers.etag,
result = {part: part.id, etag: etag, size: part.length};
mpu.emit('uploaded', result);
@@ -213,7 +213,7 @@ MultiPartUpload.prototype._uploadPart = function(part, callback) {
partStream.pipe(req);
mpu.emit('uploading', part.id);
-}
+};
/**
Indicates that all uploads have been started and that we should wait for completion
@@ -247,6 +247,6 @@ MultiPartUpload.prototype._completeUploads = function(callback) {
req.write('<CompleteMultipartUpload>' + parts + '</CompleteMultipartUpload>');
req.end();
});
-}
+};
module.exports = MultiPartUpload;

0 comments on commit 84d4a75

Please sign in to comment.