JSPM

  • Created
  • Published
  • Downloads 833
  • Score
    100M100P100Q99036F
  • License MIT

Reduct Storage Client SDK for Javascript/NodeJS/Typescript

Package Exports

  • reduct-js
  • reduct-js/lib/cjs/index.js
  • reduct-js/lib/esm/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (reduct-js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Reduct Storage Client SDK for JavaScript

GitHub release (latest SemVer) npm GitHub Workflow Status

Asynchronous HTTP client for Reduct Storage written in TypeScript.

Features

  • Promise based
  • Support Reduct Storage API v1.1
  • Token authentication

Getting Started

Read here, how to run Reduct Storage. Then install the package:

npm i reduct-js

And run this example:

const {Client} = require("../lib/cjs/index.js");

const client = new Client("http://127.0.0.1:8383");

const main = async () => {
    const bucket = await client.getOrCreateBucket("bucket");

    const timestamp = Date.now() * 1000;
    let record = await bucket.beginWrite("entry-1", timestamp);
    await record.write("Hello, World!");

    record = await bucket.beginRead("entry-1", timestamp);
    console.log((await record.read()).toString());
};

main()
    .then(() => console.log("done"))
    .catch((err) => console.error("oops: ", err));