0.1.5 • Published 1 year ago

light-s3 v0.1.5

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

light-s3

Downloads

Simple and lightweight s3-compatible client.

Features

  • dependencies free 💭
  • low size 🚀
  • typescript support ⚡️

Usage

import { query } from '../lib/index.mjs';

async function myRequestImpl(req) {
  const options = {
    method: req.method,
    headers: req.headers,
  };

  if (req.body) {
    options.body = req.body;
  }

  const response = await fetch(req.url, options);

  return {
    status: response.status,
    body: await response.arrayBuffer()
  };
}

const client = {
  base: process.env.S3_HOST,
  region: process.env.S3_REGION,
  secret: process.env.S3_SECRET,
  keyId: process.env.S3_KEY_ID,
  service: 's3',
  request: myRequestImpl
};

query({
  client,
  method: 'PUT',
  key: '/file.txt',
  buffer: Buffer.from([1, 2, 3])
}).then(console.log);
0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago