lib/request.js
function abort() {
    this.removeAllListeners('validateResponse');
    this.removeAllListeners('extractError');
    this.on('validateResponse', function addAbortedError(resp) {
      resp.error = AWS.util.error(new Error('Request aborted by user'), {
         code: 'RequestAbortedError', retryable: false
      });
    });

    if (this.httpRequest.stream) { // abort HTTP stream
      this.httpRequest.stream.abort();
      if (this.httpRequest._abortCallback) {
         this.httpRequest._abortCallback();
      } else {
        this.removeAllListeners('send'); // haven't sent yet, so let's not
      }
    }

    return this;
  }
function abort() {
    this.removeAllListeners('validateResponse');
    this.removeAllListeners('extractError');
    this.on('validateResponse', function addAbortedError(resp) {
      resp.error = AWS.util.error(new Error('Request aborted by user'), {
         code: 'RequestAbortedError', retryable: false
      });
    });

    if (this.httpRequest.stream) { // abort HTTP stream
      this.httpRequest.stream.abort();
      if (this.httpRequest._abortCallback) {
         this.httpRequest._abortCallback();
      } else {
        this.removeAllListeners('send'); // haven't sent yet, so let's not
      }
    }

    return this;
  }
Aborts a request, emitting the error and complete events.

@!macro nobrowser
@example Aborting a request after sending
var params = {
Bucket: 'bucket', Key: 'key',
Body: new Buffer(1024 * 1024 * 5) // 5MB payload
};
var request = s3.putObject(params);
request.send(function (err, data) {
if (err) console.log("Error:", err.code, err.message);
else console.log(data);
});

// abort request in 1 second
setTimeout(request.abort.bind(request), 1000);

// prints "Error: RequestAbortedError Request aborted by user"
@return [AWS.Request] the same request object, for chaining.
@since v1.4.0