New:Microsoft Teams Notifications Are Now Available in Socket.Learn more →
Get Started

@strav/storage

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@strav/storage

Strav storage layer — Storage abstraction + LocalStorage (Bun.file + node:fs) + S3Storage (Bun.S3Client, works with AWS / R2 / B2 / Tigris / MinIO via the endpoint option). Kernel-free; mirrors @strav/cache + @strav/broadcast.

npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

@strav/storage

Object storage / filesystem abstraction for Strav 1.0. Two drivers — local filesystem and S3-compatible (AWS / R2 / B2 / Tigris / MinIO via the endpoint option). Apps inject the abstract Storage token; the provider in the container picks the concrete driver. Same dependency shape as @strav/cache and @strav/broadcast.

import { Storage } from '@strav/storage'

@inject()
class ReportsController {
  constructor(private readonly storage: Storage) {}

  async upload(req: Request): Promise<Response> {
    const body = await req.arrayBuffer()
    await this.storage.put(`reports/${ulid()}.pdf`, body, {
      contentType: 'application/pdf',
      visibility: 'private',
    })
    return new Response(null, { status: 201 })
  }

  async share(path: string): Promise<string> {
    return this.storage.signedUrl(path, { expiresIn: 3600 })
  }
}

Canonical docs live in docs/storage/README.md.

What ships

DriverSubpathNotes
Local@strav/storage (root) + @strav/storage/localBun.file + Bun.write + node:fs/promises. Single-node deployments + dev.
S3-compatible@strav/storage/s3Bun's built-in S3Client — no third-party Bun S3 client dep. Works with AWS S3, Cloudflare R2, Backblaze B2, Tigris, MinIO via the endpoint option.

All paths funnel through a strict normalizer (no ../, no absolute paths, no backslashes) so controller code stays portable between drivers. Visibility maps to S3 ACL ('public' → public-read, 'private' → private); on LocalStorage it's a hint only — apps serving uploads via a static handler get the "public" semantic for free.

FAQs

Package last updated on 01 Jun 2026

Related posts