Skip to content
This repository has been archived by the owner on Jul 27, 2021. It is now read-only.

dxos-deprecated/random-access-multi-storage

Repository files navigation

Random Access Multi Storage

Build Status Coverage Status Greenkeeper badge js-semistandard-style standard-readme compliant

Factory for creating platform-specific random-access-storage files.

Install

$ npm install @dxos/random-access-multi-storage

Usage

import { createStorage } from '@dxos/random-access-multi-storage';

const storage = createStorage('./dir');

const file = storage('test.txt')
file.write(0, Buffer('hello'), err => {
  file.read(0, 5, (err, data) => {
    console.log(data.toString())
  })
});

API

createStorage(rootPath: String, storageType?: StorageType) => RandomAccessStorage

Create a RandomAccessStorage based in the storageType. If storageType is not specified, return a default RandomAccessStorage depending on the environment.

  • rootPath: Root path to store the files.
  • storageType: Storage type.

Available storages:

import { STORAGE_CHROME, STORAGE_FIREFOX, ... } from '@dxos/random-access-multi-storage'

Contributing

PRs accepted.

License

GPL-3.0 © dxos

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published