lib/s3/managed_upload.js
function(callback) {
    var self = this;
    self.failed = false;
    self.callback = callback || function(err) { if (err) throw err; };

    var runFill = true;
    if (self.sliceFn) {
      self.fillQueue = self.fillBuffer;
    } else if (AWS.util.isNode()) {
      var Stream = AWS.util.stream.Stream;
      if (self.body instanceof Stream) {
        runFill = false;
        self.fillQueue = self.fillStream;
        self.partBuffers = [];
        self.body.
          on('error', function(err) { self.cleanup(err); }).
          on('readable', function() { self.fillQueue(); }).
          on('end', function() {
            self.isDoneChunking = true;
            self.numParts = self.totalPartNumbers;
            self.fillQueue.call(self);

            if (self.isDoneChunking && self.totalPartNumbers >= 1 && self.doneParts === self.numParts) {
              self.finishMultiPart();
            }
          });
      }
    }

    if (runFill) self.fillQueue.call(self);
  }
function(callback) {
    var self = this;
    self.failed = false;
    self.callback = callback || function(err) { if (err) throw err; };

    var runFill = true;
    if (self.sliceFn) {
      self.fillQueue = self.fillBuffer;
    } else if (AWS.util.isNode()) {
      var Stream = AWS.util.stream.Stream;
      if (self.body instanceof Stream) {
        runFill = false;
        self.fillQueue = self.fillStream;
        self.partBuffers = [];
        self.body.
          on('error', function(err) { self.cleanup(err); }).
          on('readable', function() { self.fillQueue(); }).
          on('end', function() {
            self.isDoneChunking = true;
            self.numParts = self.totalPartNumbers;
            self.fillQueue.call(self);

            if (self.isDoneChunking && self.totalPartNumbers >= 1 && self.doneParts === self.numParts) {
              self.finishMultiPart();
            }
          });
      }
    }

    if (runFill) self.fillQueue.call(self);
  }
function ( callback ) { var self = this ; self . failed = false ; self . callback = callback || function ( err ) { if ( err ) throw err ; } ; var runFill = true ; if ( self . sliceFn ) { self . fillQueue = self . fillBuffer ; } else if ( AWS . util . isNode ( ) ) { var Stream = AWS . util . stream . Stream ; if ( self . body instanceof Stream ) { runFill = false ; self . fillQueue = self . fillStream ; self . partBuffers = [ ] ; self . body . on ( 'error' , function ( err ) { self . cleanup ( err ) ; } ) . on ( 'readable' , function ( ) { self . fillQueue ( ) ; } ) . on ( 'end' , function ( ) { self . isDoneChunking = true ; self . numParts = self . totalPartNumbers ; self . fillQueue . call ( self ) ; if ( self . isDoneChunking && self . totalPartNumbers >= 1 && self . doneParts === self . numParts ) { self . finishMultiPart ( ) ; } } ) ; } } if ( runFill ) self . fillQueue . call ( self ) ; }
Initiates the managed upload for the payload.

@callback callback function(err, data)
@param err [Error] an error or null if no error occurred.
@param data [map] The response data from the successful upload:
* `Location` (String) the URL of the uploaded object
* `ETag` (String) the ETag of the uploaded object
* `Bucket` (String) the bucket to which the object was uploaded
* `Key` (String) the key to which the object was uploaded
@example Sending a managed upload object
var params = {Bucket: 'bucket', Key: 'key', Body: stream};
var upload = new AWS.S3.ManagedUpload({params: params});
upload.send(function(err, data) {
console.log(err, data);
});
Initiates the managed upload for the payload .