@ apicity/ b2 (韩语)
后放出B2 S3相容对象存储供应商.
运行时间依赖性 :
zod@^4.6.6- 请求在每一个 POST 端点上附加计划.schema
安装
npm install @apicity/b2
# or
pnpm add @apicity/b2
快速启动
import { createB2 } from "@apicity/b2";
const b2 = createB2({
accessKeyId: process.env.B2_ACCESS_KEY_ID!,
secretAccessKey: process.env.B2_SECRET_ACCESS_KEY!,
region: process.env.B2_REGION!,
endpoint: process.env.B2_ENDPOINT,
});
@apicity/b2 将它的 S3 兼容的签名、 传输、 响应解析和策略本地化, 而只曝光 Backflaze 支持的呼叫 .
API 参考
横跨两组的39个终点. 每个方法都映射出上游的 URL 路径 .
桶头
PUT b2.buckets.create
PUT https://s3.us-west-004.backblazeb2.com/{bucket}
成本等级 : cheap
const res = await b2.buckets.create({ /* ... */ });
DELETE b2.buckets.del
DELETE https://s3.us-west-004.backblazeb2.com/{bucket}
成本等级 : cheap
const res = await b2.buckets.del({ /* ... */ });
DELETE b2.buckets.delCors
DELETE https://s3.us-west-004.backblazeb2.com/{bucket}?cors
成本等级 : cheap
const res = await b2.buckets.delCors({ /* ... */ });
DELETE b2.buckets.delEncryption
DELETE https://s3.us-west-004.backblazeb2.com/{bucket}?encryption
成本等级 : cheap
const res = await b2.buckets.delEncryption({ /* ... */ });
GET b2.buckets.getAcl
GET https://s3.us-west-004.backblazeb2.com/{bucket}?acl
成本等级 : cheap
const res = await b2.buckets.getAcl({ /* ... */ });
GET b2.buckets.getCors
GET https://s3.us-west-004.backblazeb2.com/{bucket}?cors
成本等级 : cheap
const res = await b2.buckets.getCors({ /* ... */ });
GET b2.buckets.getEncryption
GET https://s3.us-west-004.backblazeb2.com/{bucket}?encryption
成本等级 : cheap
const res = await b2.buckets.getEncryption({ /* ... */ });
GET b2.buckets.getObjectLockConfiguration
GET https://s3.us-west-004.backblazeb2.com/{bucket}?object-lock
成本等级 : cheap
const res = await b2.buckets.getObjectLockConfiguration({ /* ... */ });
GET b2.buckets.getVersioning
GET https://s3.us-west-004.backblazeb2.com/{bucket}?versioning
成本等级 : cheap
const res = await b2.buckets.getVersioning({ /* ... */ });
HEAD b2.buckets.head
HEAD https://s3.us-west-004.backblazeb2.com/{bucket}
成本等级 : cheap
const res = await b2.buckets.head({ /* ... */ });
GET b2.buckets.list
GET https://s3.us-west-004.backblazeb2.com/
成本等级 : cheap
const res = await b2.buckets.list({ /* ... */ });
GET b2.buckets.location
GET https://s3.us-west-004.backblazeb2.com/{bucket}?location
成本等级 : cheap
const res = await b2.buckets.location({ /* ... */ });
PUT b2.buckets.putAcl
PUT https://s3.us-west-004.backblazeb2.com/{bucket}?acl
成本等级 : cheap
const res = await b2.buckets.putAcl({ /* ... */ });
PUT b2.buckets.putCors
PUT https://s3.us-west-004.backblazeb2.com/{bucket}?cors
成本等级 : cheap
const res = await b2.buckets.putCors({ /* ... */ });
PUT b2.buckets.putEncryption
PUT https://s3.us-west-004.backblazeb2.com/{bucket}?encryption
成本等级 : cheap
const res = await b2.buckets.putEncryption({ /* ... */ });
PUT b2.buckets.putObjectLockConfiguration
PUT https://s3.us-west-004.backblazeb2.com/{bucket}?object-lock
成本等级 : cheap
const res = await b2.buckets.putObjectLockConfiguration({ /* ... */ });
对象
DELETE b2.objects.abortMultipartUpload
DELETE https://s3.us-west-004.backblazeb2.com/{bucket}/{key}{query}
成本等级 : cheap
const res = await b2.objects.abortMultipartUpload({ /* ... */ });
POST b2.objects.completeMultipartUpload
POST https://s3.us-west-004.backblazeb2.com/{bucket}/{key}{query}
成本等级 : cheap
const res = await b2.objects.completeMultipartUpload({ /* ... */ });
PUT b2.objects.copy
PUT https://s3.us-west-004.backblazeb2.com/{bucket}/{key}
成本等级 : cheap
const res = await b2.objects.copy({ /* ... */ });
POST b2.objects.createMultipartUpload
POST https://s3.us-west-004.backblazeb2.com/{bucket}/{key}?uploads
成本等级 : cheap
const res = await b2.objects.createMultipartUpload({ /* ... */ });
DELETE b2.objects.del
DELETE https://s3.us-west-004.backblazeb2.com/{bucket}/{key}{query}
成本等级 : cheap
const res = await b2.objects.del({ /* ... */ });
POST b2.objects.delMany
POST https://s3.us-west-004.backblazeb2.com/{bucket}?delete
成本等级 : cheap
const res = await b2.objects.delMany({ /* ... */ });
GET b2.objects.get
GET https://s3.us-west-004.backblazeb2.com/{bucket}/{key}{query}
成本等级 : cheap
const res = await b2.objects.get({ /* ... */ });
GET b2.objects.getAcl
GET https://s3.us-west-004.backblazeb2.com/{bucket}/{key}?acl{query}
成本等级 : cheap
const res = await b2.objects.getAcl({ /* ... */ });
GET b2.objects.getLegalHold
GET https://s3.us-west-004.backblazeb2.com/{bucket}/{key}?legal-hold{query}
成本等级 : cheap
const res = await b2.objects.getLegalHold({ /* ... */ });
GET b2.objects.getRetention
GET https://s3.us-west-004.backblazeb2.com/{bucket}/{key}?retention{query}
成本等级 : cheap
const res = await b2.objects.getRetention({ /* ... */ });
GET b2.objects.getStream
GET https://s3.us-west-004.backblazeb2.com/{bucket}/{key}{query}
成本等级 : cheap
const res = await b2.objects.getStream({ /* ... */ });
HEAD b2.objects.head
HEAD https://s3.us-west-004.backblazeb2.com/{bucket}/{key}{query}
成本等级 : cheap
const res = await b2.objects.head({ /* ... */ });
GET b2.objects.list
GET https://s3.us-west-004.backblazeb2.com/{bucket}?list-type=2{query}
成本等级 : cheap
const res = await b2.objects.list({ /* ... */ });
GET b2.objects.listLegacy
GET https://s3.us-west-004.backblazeb2.com/{bucket}{query}
成本等级 : cheap
const res = await b2.objects.listLegacy({ /* ... */ });
GET b2.objects.listMultipartUploads
GET https://s3.us-west-004.backblazeb2.com/{bucket}?uploads{query}
成本等级 : cheap
const res = await b2.objects.listMultipartUploads({ /* ... */ });
GET b2.objects.listParts
GET https://s3.us-west-004.backblazeb2.com/{bucket}/{key}{query}
成本等级 : cheap
const res = await b2.objects.listParts({ /* ... */ });
GET b2.objects.listVersions
GET https://s3.us-west-004.backblazeb2.com/{bucket}?versions{query}
成本等级 : cheap
const res = await b2.objects.listVersions({ /* ... */ });
PUT b2.objects.put
PUT https://s3.us-west-004.backblazeb2.com/{bucket}/{key}
成本等级 : cheap
const res = await b2.objects.put({ /* ... */ });
PUT b2.objects.putAcl
PUT https://s3.us-west-004.backblazeb2.com/{bucket}/{key}?acl{query}
成本等级 : cheap
const res = await b2.objects.putAcl({ /* ... */ });
PUT b2.objects.putLegalHold
PUT https://s3.us-west-004.backblazeb2.com/{bucket}/{key}?legal-hold{query}
成本等级 : cheap
const res = await b2.objects.putLegalHold({ /* ... */ });
PUT b2.objects.putRetention
PUT https://s3.us-west-004.backblazeb2.com/{bucket}/{key}?retention{query}
成本等级 : cheap
const res = await b2.objects.putRetention({ /* ... */ });
PUT b2.objects.uploadPart
PUT https://s3.us-west-004.backblazeb2.com/{bucket}/{key}{query}
成本等级 : cheap
const res = await b2.objects.uploadPart({ /* ... */ });
PUT b2.objects.uploadPartCopy
PUT https://s3.us-west-004.backblazeb2.com/{bucket}/{key}{query}
成本等级 : cheap
const res = await b2.objects.uploadPartCopy({ /* ... */ });
部分 辣点 单相机.
许可证
麻省理工学院——见 自由主义。 。 。 .