0.1.2 • Published 4 years ago

pambda-s3-fetch v0.1.2

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

pambda-s3-fetch

S3バケット上のコンテンツをレンダリングする Pambda.

Installation

npm i pambda-s3-fetch -S

Usage

import { compose, createLambda } from 'pambda';
import { binarySupport } from 'pambda-binary-support';
import { s3Fetch } from 'pambda-s3-fetch';

export const handler = createLambda(
  compose(
    binarySupport(['image/*']),
    s3Fetch({
      basePath: '/',
      s3Uri: 's3://bucket/base',
      mapper(path) {
        const mapping = {
          '/': '/index.html',
        };

        return mapping[path] || path;
      },
    })
  )
);

s3Fetch(options)

  • options.basePath
    • この Pambda で処理する基点となるパス。
  • options.s3Uri
    • レンダリング対象となるS3バケット上の位置。
    • bucketkey オプションと同時に指定することはできない。
  • options.bucket
    • レンダリング対象となるS3バケットの名前。
  • options.key
    • レンダリング対象となるS3バケット上の基点となるキー。
  • options.maxAge
    • キャッシュの有効期限を秒数単位で指定する。
  • options.mapper(path)
    • リクエストパスをマップするための関数。

License

MIT

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

5 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago