@dashpilot/s3-json-db

中文文档
1.1.0发布于 2023/08/02CommonJS近 30 天下载 3506

使用 S3 作为简单的 json 数据库和没有服务器的 API

中文使用文档
文档目录5 节
  1. 关于
  2. 安装
  3. 使用量
  4. 配置
  5. 按: star: 按钮

s3 -- -- json -- -- db

使用 Amazon S3 作为简单的 JSON 数据库和没有服务器的 API

关于

S3 JSON DB是亚马逊S3的一个简单的基于文件的JSON数据库. 它允许您插入,更新,检索和删除条目. 所有条目都存储在S3上,作为单个json文件中的对象,因此您也可以轻松地从单一页面应用程序或任何服务器侧已渲染的应用程序中取出(不需要这个模块). 您可以使用它来快速为您的 SPA 原型一个没有服务器的应用程序或后端. 与亚马逊S3相兼容,数字海洋空间,Linode对象存储,后布雷泽B2等. https://www.npmjs.com/package/@dashpilot/s3-json-db

安装

npm install @dashpilot/s3-json-db

使用量

const S3DB = require('s3-json-db');
const db = new S3DB(s3_key, s3_secret, s3_bucket, s3_prefix, s3_acl, s3_endpoint);
const table = 'entries';

let data = {
  title: 'This is the first entry',
  body: 'Lorem ipsum dolor site amet'
}

// insert
db.insert(table, data).then(id => {
  console.log("created " + id);
});

// update
db.update(table, data, id).then(id => {
  console.log("updated " + id);
});

// delete
db.delete(table, id).then(id => {
  console.log("deleted " + id);
});

// get one entry by id
db.get(table, id).then(data => {
  console.log(data);
});

// get all entries
db.get_all(table).then(data => {
  console.log(data);
});

配置

s3_key (required): your S3 API key
s3_secret (required): your S3 API secret
s3_bucket (required): your S3 bucket
s3_prefix (optional): optional file prefix or subfolder (for the latter end with a slash). default "";
s3_acl (optional): ACL (https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl). Default: "private", set to "public-read" if you want your data to be public (to use with a client-side app).
s3_endpoint (optional): change the endpoint if you use Digitalocean Spaces, Linode Object Storage, Backblaze B2, etc. Default: false.

要获取所有条目客户端( 设置 s3 ACL 为“ 公共阅读 ” ):

{your_s3_url}/{bucket}/{s3_prefix}/{table}.json

按: star: 按钮

别忘了按下:星:按下按钮让我知道,我应该继续改进这个项目.

版本与发布记录

@dashpilot/s3-json-db 共发布 10 个版本,首次发布于 2020/02/01;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.1.0latest2023/08/023 年前
1.0.92021/12/084 年前
1.0.72021/01/115 年前
1.0.62021/01/115 年前
1.0.52020/02/026 年前
1.0.42020/02/026 年前

关于 @dashpilot/s3-json-db 的常见问题

@dashpilot/s3-json-db 是什么?

使用 S3 作为简单的 json 数据库和没有服务器的 API

如何安装 @dashpilot/s3-json-db?

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

@dashpilot/s3-json-db 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/dashpilot__s3-json-db 是否存在。

@dashpilot/s3-json-db 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@dashpilot/s3-json-db 可以商用吗?

@dashpilot/s3-json-db 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@dashpilot/s3-json-db 的下载量有多少?

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

@dashpilot/s3-json-db 还在维护吗?

最新版本 1.1.0 发布于 2023/08/02(3 年前);至今共发布 10 个版本,其中过去 12 个月发布了 0 个;首次发布于 2020/02/01。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。