0.0.11 • Published 10 months ago

middy-store-s3 v0.0.11

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Amazon S3 Store middy-store-s3

This package provides a Store implementation for middy-store that uses Amazon S3 to store and load payloads. It uses the @aws-sdk/client-s3 to interact with Amazon S3.

Prerequisites

This package middy-store-s3 and its docs only cover the Amazons S3 Store. Please read the docs for middy-store for more information on how to use the middy-store package.

Install

npm install middy-store middy-store-s3

Usage

import { middyStore } from 'middy-store';
import { S3Store } from 'middy-store-s3';

const handler = middy()
  .use(
    middyStore({
      stores: [
        new S3Store({
          config: { region: "us-east-1" },
          bucket: "bucket",
          key: ({ payload }) => randomUUID(),
          format: "arn",
        }),
      ],
    }),
  )
  .handler(async (input) => {
    return {
      random: randomBytes(1024 * 1024).toString("hex"),
    };
  });

Options

The S3Store accepts the following options:

OptionTypeDefaultDescription
bucketstring \| Fn<string>RequiredThe name of the S3 bucket to store the payloads.
keystring \| Fn<string>randomUUIDThe key to store the payload in the bucket. Defaults to randomUUID() from node:crypto.
configS3ClientConfig \| Fn<S3ClientConfig>{}The S3 client configuration.
formatS3ReferenceFormaturl-s3-global-pathThe format of the S3 reference: arn, object or one of the URL formats from amazon-s3-url package. Defaults to S3 URI format s3://<bucket>/<...keys>.
maxSizenumberundefinedThe maximum payload size in bytes that can be stored in S3. If the payload exceeds this size, it will not be stored in S3.
loggerLoggerundefinedThe logger function to use for logging.
0.0.10

10 months ago

0.0.11

10 months ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.5

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.1

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.4

1 year ago

0.0.0

1 year ago

0.0.0-alpha.28

2 years ago

0.0.0-alpha.27

2 years ago

0.0.0-alpha.26

2 years ago

0.0.0-alpha.24

2 years ago

0.0.0-alpha.25

2 years ago

0.0.0-alpha.23

2 years ago

0.0.0-alpha.22

2 years ago

0.0.0-alpha.19

2 years ago

0.0.0-alpha.18

2 years ago

0.0.0-alpha.20

2 years ago

0.0.0-alpha.13

2 years ago

0.0.0-alpha.12

2 years ago

0.0.0-alpha.11

2 years ago

0.0.0-alpha.21

2 years ago

0.0.0-alpha.10

2 years ago

0.0.0-alpha.17

2 years ago

0.0.0-alpha.16

2 years ago

0.0.0-alpha.15

2 years ago

0.0.0-alpha.14

2 years ago

0.0.0-alpha.9

2 years ago

0.0.0-alpha.8

2 years ago

0.0.0-alpha.7

2 years ago

0.0.0-alpha.6

2 years ago

0.0.0-alpha.5

2 years ago

0.0.0-alpha.3

2 years ago

0.0.0-alpha.2

2 years ago

0.0.0-alpha.1

2 years ago

0.0.0-alpha.0

2 years ago