stream-s3-object

1.0.4 • Public • Published

stream-s3-object

Usage

const AWS = require('aws-sdk')
const streamS3Object = require('stream-s3-object')
const s3 = new AWS.S3()
 
const getObjectRequest = s3.getObject({ /* whatever */ })
const { getHeader, headers, stream } = await streamS3Object(getObjectRequest)

Returned properties

The function returns an object containing the following properties asynchronously (i.e. as a Promise):

  • getHeader(name: string): string?
    • Get the string value of the specified header name (or undefined), with case-insensitive matching
  • headers: { [name: string]: string }
    • The exact headers object returned from the AWS SDK
  • stream: stream.Readable
    • A readable stream representing the S3 object being retrieved, from s3.getObject(...).createReadStream()

Errors

The streamS3Object() call will throw a TypeError synchronously if the input doesn't appear to be a request object from the s3 getObject() method. The returned Promise will be rejected with the error value from any httpError event that is raised on the getObject() request.

See Also

Dependencies (0)

    Dev Dependencies (6)

    Package Sidebar

    Install

    npm i stream-s3-object

    Weekly Downloads

    1

    Version

    1.0.4

    License

    Apache-2.0

    Unpacked Size

    6.1 kB

    Total Files

    8

    Last publish

    Collaborators

    • bchociej