JSPM

flex-docstore

0.1.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q32343F
  • License MIT

JSON Document store with flexible backend (files on fs, PouchDB, etc)

Package Exports

  • flex-docstore

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 (flex-docstore) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Flexible Document Store (flex-docstore)

JSON Document store with flexible backend (files on fs, PouchDB, etc)

Table of Contents

Security

TBD

Background

TBD

Install

Requires Node.js 8.10+.

npm install flex-docstore

Usage

Requiring

const Store = require('flex-docstore')

FS Backend (one file per object)

const store = Store.using('files', { dir: './db' })

Mock Backend (for unit testing)

const store = Store.using('mock')

API

The storage API is based on the PouchDB API

  • post is not implemented (use uuid + put)
get

async get (key)

Retrieves the document at a given key (null if not found).

const data = await store.get('key1')
put

async put (key, value)

Writes a document to a given key.

await store.put('key1', doc)
remove

async remove (key)

Deletes a document.

await store.remove('key1')
allDocs

async allDocs ()

Lists all documents in the store.

await store.allDocs()

Contribute

PRs accepted.

Code style: Standard JS

Comments style: JSDoc.

README style: If editing the Readme, please conform to the standard-readme specification.

License

MIT LICENSE © Interop Alliance, Dmitri Zagidulin