@computesdk/s3

中文文档
1.2.24发布于 2026/11/11MITTypeScriptESM + CJS构建来源已验证近 30 天下载 2252

AWS S3 storage provider for ComputeSDK - object storage with S3-compatible API

原始使用文档
文档目录11 节
  1. Installation
  2. Usage
  3. Configuration
  4. API
  5. upload(bucket, key, data, options?)
  6. download(bucket, key)
  7. delete(bucket, key)
  8. list(bucket, options?)
  9. getClient()
  10. Environment Variables
  11. License

@computesdk/s3

AWS S3 storage provider for ComputeSDK - object storage with S3-compatible API.

Installation

npm install @computesdk/s3

Usage

import { s3 } from '@computesdk/s3';

// Create storage instance
const storage = s3({
  accessKeyId: process.env.TIGRIS_STORAGE_ACCESS_KEY_ID,
  secretAccessKey: process.env.TIGRIS_STORAGE_SECRET_ACCESS_KEY,
  endpoint: 'https://t3.storage.dev'
});

// Upload a file
await storage.upload('my-bucket', 'path/to/file.txt', 'Hello, World!');

// Upload with options
await storage.upload('my-bucket', 'image.png', buffer, {
  contentType: 'image/png',
  metadata: { author: 'user-123' }
});

// Download a file
const result = await storage.download('my-bucket', 'path/to/file.txt');
console.log(Buffer.from(result.data).toString());

// Delete a file
await storage.delete('my-bucket', 'path/to/file.txt');

// List objects
const list = await storage.list('my-bucket', { prefix: 'path/to/' });
for (const obj of list.objects) {
  console.log(`${obj.key}: ${obj.size} bytes`);
}

Configuration

OptionTypeRequiredDefaultDescription
accessKeyIdstringNo*TIGRIS_STORAGE_ACCESS_KEY_ID envAccess key ID
secretAccessKeystringNo*TIGRIS_STORAGE_SECRET_ACCESS_KEY envSecret access key
endpointstringNoTIGRIS_STORAGE_ENDPOINT env, then https://t3.storage.devEndpoint of the S3-compatible service

*Either provide in config or set environment variables.

API

upload(bucket, key, data, options?)

Upload data to S3.

  • bucket: Bucket name
  • key: Object key/path
  • data: Uint8Array or string to upload (Node Buffer also works as it's a Uint8Array subclass)
  • options: Optional upload configuration
    • contentType: MIME type (default: application/octet-stream)
    • metadata: Custom metadata object

Returns Promise<StorageObject> with metadata about the uploaded object.

download(bucket, key)

Download data from S3.

  • bucket: Bucket name
  • key: Object key/path

Returns Promise<DownloadResult> containing:

  • data: Uint8Array with object contents (Node Buffer can be created with Buffer.from(data))
  • size: Object size in bytes
  • contentType: MIME type
  • etag: Entity tag
  • lastModified: Last modification date
  • metadata: Custom metadata

delete(bucket, key)

Delete object from S3.

  • bucket: Bucket name
  • key: Object key/path

Returns Promise<void>.

list(bucket, options?)

List objects in bucket.

  • bucket: Bucket name
  • options: Optional list configuration
    • prefix: Filter by prefix
    • maxKeys: Maximum results (default: 1000)
    • continuationToken: Pagination token

Returns Promise<ListResult> containing:

  • objects: Array of StorageObject
  • truncated: Whether there are more results
  • continuationToken: Token for next page

getClient()

Get the underlying AWS S3 client for advanced operations.

Returns S3Client from @aws-sdk/client-s3.

Environment Variables

export AWS_ACCESS_KEY_ID=your-access-key
export AWS_SECRET_ACCESS_KEY=your-secret-key
export AWS_REGION=us-east-1  # optional, defaults to us-east-1

License

MIT

版本与发布记录

@computesdk/s3 共发布 31 个版本,首次发布于 2026/03/24;过去 12 个月发布了 31 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.2.24latest2026/11/11今天
1.2.232026/11/064 天前
1.2.222026/11/046 天前
1.2.212026/10/2813 天前
1.2.202026/10/2318 天前
1.2.192026/10/2319 天前

关于 @computesdk/s3 的常见问题

@computesdk/s3 是什么?

AWS S3 storage provider for ComputeSDK - object storage with S3-compatible API

如何安装 @computesdk/s3?

在项目目录运行 npm install @computesdk/s3,或使用 pnpm add / yarn add / bun add。

@computesdk/s3 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@computesdk/s3 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@computesdk/s3 可以商用吗?

@computesdk/s3 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@computesdk/s3 的下载量有多少?

根据 npm 官方下载统计,@computesdk/s3 在 2026/10/11 – 2026/11/09 这 30 天内被下载 2,252 次,日均约 75 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@computesdk/s3 还在维护吗?

最新版本 1.2.24 发布于 2026/11/11(今天);至今共发布 31 个版本,其中过去 12 个月发布了 31 个;首次发布于 2026/03/24。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。