JSPM

koa-s3-proxy

0.1.4
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 17
  • Score
    100M100P100Q50097F
  • License ISC

S3 proxy middleware for Koa

Package Exports

  • koa-s3-proxy

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (koa-s3-proxy) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

koa-s3-proxy

Koa S3 proxy middleware.

This library is based on minio/minio-js.

Installation

$ npm install koa-s3-proxy

API

const Koa = require('koa');
const mount = require('koa-mount');
const KoaS3ProxyServe = require('koa-s3-proxy');

const app = new Koa();

app.use(
    mount(
        '/attachments/',
        KoaS3ProxyServe({
            endPoint: '127.0.0.1',
            port: 9000,
            useSSL: false,
            accessKey: 'admin',
            secretKey: 'password',
            bucketName: 'attachments'
        })
    )
);

app.listen(3000);

How to execute example.js

$ docker-compose up -d
$ npm install
$ node example.js

Open your browser on http://127.0.0.1:3000/attachments/earth.png

You can use filename query parameter to rename the filename:

You can put inline or attachment (default value) in contentDisposition query parameter to configure Content-Disposition response header