JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q23002F
  • License ISC

A random access storage that can be used in simple databases.

Package Exports

  • rastorage

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

Readme

Random Access Storage - RAStorage

This library is intended to provide a native tiny storage using schemes from modern file systems. Input data is divided into different 261-fixed-sized blocks ( each of which can store up to 255 bytes data segment ).

The library can store 2^32-1 blocks at max.

Example

const {RAStorage} = require('rastorage');
const storage = RAStorage.InitAtPath( 'path to the storage dir' );



let promises = [];
promises.push(storage.put(Buffer.from(data)));        // Insert data and returns the initial block id
promises.push(storage.set(10, Buffer.from(data)));  // Replace data began with block #10
promises.push(storage.del(20, Buffer.from(data)));  // Delete data began with block #20
promises.push(storage.get(1);                                 // Get data began with block #1

await Promise.all(promises);