lib/s3-upload-stream.js
function (callback) {
    var partBuffer = preparePartBuffer();

    var localPartNumber = partNumber;
    partNumber++;
    receivedSize += partBuffer.length;
    cachedClient.uploadPart(
      {
        Body: partBuffer,
        Bucket: destinationDetails.Bucket,
        Key: destinationDetails.Key,
        UploadId: multipartUploadID,
        PartNumber: localPartNumber
      },
      function (err, result) {
        if (err)
          abortUpload('Failed to upload a part to S3: ' + JSON.stringify(err));
        else {
          uploadedSize += partBuffer.length;
          partIds[localPartNumber - 1] = {
            ETag: result.ETag,
            PartNumber: localPartNumber
          };

          callback({
            ETag: result.ETag,
            PartNumber: localPartNumber,
            receivedSize: receivedSize,
            uploadedSize: uploadedSize
          });
        }
      }
    );
  }
function (callback) {
    var partBuffer = preparePartBuffer();

    var localPartNumber = partNumber;
    partNumber++;
    receivedSize += partBuffer.length;
    cachedClient.uploadPart(
      {
        Body: partBuffer,
        Bucket: destinationDetails.Bucket,
        Key: destinationDetails.Key,
        UploadId: multipartUploadID,
        PartNumber: localPartNumber
      },
      function (err, result) {
        if (err)
          abortUpload('Failed to upload a part to S3: ' + JSON.stringify(err));
        else {
          uploadedSize += partBuffer.length;
          partIds[localPartNumber - 1] = {
            ETag: result.ETag,
            PartNumber: localPartNumber
          };

          callback({
            ETag: result.ETag,
            PartNumber: localPartNumber,
            receivedSize: receivedSize,
            uploadedSize: uploadedSize
          });
        }
      }
    );
  }
function ( callback ) { var partBuffer = preparePartBuffer ( ) ; var localPartNumber = partNumber ; partNumber ++ ; receivedSize += partBuffer . length ; cachedClient . uploadPart ( { Body : partBuffer , Bucket : destinationDetails . Bucket , Key : destinationDetails . Key , UploadId : multipartUploadID , PartNumber : localPartNumber } , function ( err , result ) { if ( err ) abortUpload ( 'Failed to upload a part to S3: ' + JSON . stringify ( err ) ) ; else { uploadedSize += partBuffer . length ; partIds [ localPartNumber - 1 ] = { ETag : result . ETag , PartNumber : localPartNumber } ; callback ( { ETag : result . ETag , PartNumber : localPartNumber , receivedSize : receivedSize , uploadedSize : uploadedSize } ) ; } } ) ; }
Flush a part out to S3.
Flush a part out to S3 .