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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@dashpilot/s3-json-db

v1.1.0

Published

Use S3 as a simple json database and serverless API

Downloads

205

Readme

s3-json-db

Use Amazon S3 as a simple JSON database and serverless API

About

S3 JSON DB is a simple file-based JSON database for Amazon S3. It allows you to insert, update, retrieve and delete entries. All entries are stored on S3 as objects in a single json file, so you can also easily retrieve them from a Single Page Application or any server-side rendered app (without needing this module). You can use it to quickly prototype a serverless app or backend for your SPA. Compatible with Amazon S3, Digitalocean Spaces, Linode Object Storage, BackBlaze B2, etc. https://www.npmjs.com/package/@dashpilot/s3-json-db

Installation

npm install @dashpilot/s3-json-db

Usage

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);
});

Configuration

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.

To retrieve all entries client-side (set s3_acl to "public-read"):

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

Press the :star: button

Don't forget to press the :star: button to let me know I should continue improving this project.