npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@arraypress/storage-s3

v1.0.0

Published

S3-compatible storage adapter for @arraypress/storage (AWS S3, R2 via S3 API, MinIO, DigitalOcean Spaces)

Downloads

69

Readme

@arraypress/storage-s3

S3-compatible storage adapter for @arraypress/storage. Works with AWS S3, Cloudflare R2 (via S3 API), MinIO, DigitalOcean Spaces, and any S3-compatible service.

Works in Node.js, Cloudflare Workers, Deno, Bun, and any runtime that supports the AWS SDK.

Installation

npm install @arraypress/storage-s3 @arraypress/storage

This package depends on @aws-sdk/client-s3 and @aws-sdk/s3-request-presigner (installed automatically).

Usage

AWS S3

import { createS3Storage } from '@arraypress/storage-s3';

const storage = createS3Storage({
  bucket: 'my-bucket',
  region: 'us-east-1',
  accessKeyId: process.env.AWS_ACCESS_KEY_ID,
  secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
  publicUrl: 'https://my-bucket.s3.amazonaws.com',
});

// Upload
await storage.upload({
  key: 'uploads/photo.jpg',
  body: fileBuffer,
  contentType: 'image/jpeg',
});

// Download
const file = await storage.download('uploads/photo.jpg');
if (file) {
  console.log(file.contentType); // 'image/jpeg'
  console.log(file.size);        // bytes
}

// Signed URLs (for direct client uploads)
const signed = await storage.getSignedUploadUrl({
  key: 'uploads/new-file.jpg',
  contentType: 'image/jpeg',
  expiresIn: 3600,
});
console.log(signed.url); // Pre-signed URL for PUT

Cloudflare R2 via S3 API

Use this adapter when you need signed URLs with R2 (the native R2 bindings have limited presigned URL support).

import { createS3Storage } from '@arraypress/storage-s3';

const storage = createS3Storage({
  bucket: 'my-bucket',
  region: 'auto',
  endpoint: 'https://ACCOUNT_ID.r2.cloudflarestorage.com',
  accessKeyId: env.R2_ACCESS_KEY_ID,
  secretAccessKey: env.R2_SECRET_ACCESS_KEY,
  publicUrl: 'https://media.mystore.com',
});

MinIO (Self-Hosted S3)

import { createS3Storage } from '@arraypress/storage-s3';

const storage = createS3Storage({
  bucket: 'my-bucket',
  region: 'us-east-1',
  endpoint: 'http://localhost:9000',
  accessKeyId: 'minioadmin',
  secretAccessKey: 'minioadmin',
  forcePathStyle: true, // Required for MinIO
});

With Hono

import { Hono } from 'hono';
import { createS3Storage } from '@arraypress/storage-s3';

const app = new Hono();

app.post('/upload', async (c) => {
  const storage = createS3Storage({
    bucket: 'my-bucket',
    region: 'us-east-1',
    accessKeyId: process.env.AWS_ACCESS_KEY_ID,
    secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
  });

  const body = await c.req.arrayBuffer();

  const result = await storage.upload({
    key: `uploads/${Date.now()}.jpg`,
    body: new Uint8Array(body),
    contentType: 'image/jpeg',
  });

  return c.json(result);
});

Multipart Uploads

const mpu = await storage.createMultipartUpload('large-file.zip', {
  contentType: 'application/zip',
});

const part1 = await mpu.uploadPart(1, chunk1);
const part2 = await mpu.uploadPart(2, chunk2);

await mpu.complete([part1, part2]);

API Reference

createS3Storage(options): Storage

Creates a Storage adapter backed by any S3-compatible service.

Options

| Option | Type | Required | Description | |--------|------|----------|-------------| | bucket | string | Yes | S3 bucket name | | region | string | Yes | AWS region (e.g. 'us-east-1'). Use 'auto' for R2. | | endpoint | string | No | S3-compatible endpoint URL | | accessKeyId | string | Yes | AWS access key ID | | secretAccessKey | string | Yes | AWS secret access key | | publicUrl | string | No | Public URL prefix for getPublicUrl() | | forcePathStyle | boolean | No | Force path-style URLs (required for MinIO). Default: false. |

Re-exported from @arraypress/storage

  • Storage interface
  • StorageError class
  • contentHash(), contentAddressedKey(), safeDisposition() helpers
  • All type definitions

License

MIT