@jill64/types-lambda

1.2.3 • Public • Published

@jill64/types-lambda

npm-version npm-license npm-download-month npm-min-size

λ Unofficial AWS Lambda type definition

Examples

import type { LambdaHandler } from '@jill64/types-lambda'

export const handler: LambdaHandler = async (event) => {
  // ...

  return {
    statusCode: 200,
    body: 'Hello from Lambda !'
  }
}
import { awslambda } from '@jill64/types-lambda'

export const handler = awslambda.streamifyResponse(
  async (event, responseStream, _context) => {
    // ...

    const metadata = {
      statusCode: 200,
      headers: {
        'Content-Type': 'application/json'
      }
    }

    responseStream = awslambda.HttpResponseStream.from(responseStream, metadata)

    responseStream.write('Streaming with Helper \n')
    responseStream.write('Hello 0 \n')
    responseStream.write('Hello 1 \n')
    responseStream.write('Hello 2 \n')
    responseStream.end()

    await responseStream.finished()
  }
)
import type { OriginRequestHandler } from '@jill64/types-lambda'

export const handler: OriginRequestHandler = async (event, context) => {
  // ...

  return {
    status: '200'
  }
}

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i @jill64/types-lambda

Weekly Downloads

5,372

Version

1.2.3

License

MIT

Unpacked Size

40.3 kB

Total Files

40

Last publish

Collaborators

  • jill64