@tekbox/unified-storage
Unified-Storage is a simple key value storage interface for different backends. For currently available storage backends check src/adapters. To write your own storage adapter just extend AbstractStorageAdapter.
Last updated 2 years ago by r1co .
Original npm · Tarball · package.json
$ cnpm install @tekbox/unified-storage 
SYNC missed versions from official npm registry.

@tekbox/unified-storage

Unified-Storage is a simple key value storage interface for different backends. For currently available storage backends check src/adapters. To write your own storage adapter just extend AbstractStorageAdapter.

Usage

Available methods:

export interface IUnifiedStorage {
    set(key: string, value: any): ThenPromise<boolean>;

    get(key: string): ThenPromise<any>;

    rm(key: string): ThenPromise<boolean>;

    exists(key: string): ThenPromise<boolean>;

    dump(): ThenPromise<{name: string, data: any[]}>;
}

Usage:

const storage = new UnifiedStorage();
const storage2 = new UnifiedStorage("test", new FilesystemStorageAdapter("./data", "test"));

storage.set("key", "value")
    .then((data) => {
        ...
    })
    .catch((err) => {
        ...
    })

...

storage.get("key")
    .then((data) => {
       ...
    })
    .catch((err) => {
      ...
    });

Current Tags

  • 0.0.8                                ...           latest (2 years ago)

7 Versions

  • 0.0.8                                ...           2 years ago
  • 0.0.7                                ...           3 years ago
  • 0.0.6                                ...           3 years ago
  • 0.0.5                                ...           3 years ago
  • 0.0.4                                ...           3 years ago
  • 0.0.3                                ...           3 years ago
  • 0.0.2                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 2
Dependencies (1)
Dev Dependencies (11)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |