node-keep
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

node-keep

npm dev dependency version coverage

Install

npm install node-keep
# or
yarn add node-keep

Usage

See full API docs

const keep = new Keep();
// Node Keep must be initialized before it is used
await keep.init();
keep.

API

Method Description
constructor Constructs a new instance of the Keep class
init() Initializes the storage directory.
Note: This must be called before any other methods
setItem(key, value) Stores (or updates) a key-value pair in the storage directory.
getItem(key) Retrieves the value of the specified key or undefined if the key is not found.
removeItem(key) Removes a key-value pair from the storage directory.
data() Returns the data stored in the storage directory.
keys() Returns the keys of the data stored in the storage directory.
values() Returns the values of the data stored in the storage directory.
length() Returns the number of key-value pairs in the storage directory.
clear() Removes all key-value pairs from the storage directory.

Constructor

constructor(config?: Partial<Config>);

See Config

Config

export interface Config {
	/**
	 * The directory to store the data in.
	 * @defaultValue ".keep/storage"
	 */
	dir: string;

	/**
	 * A function to log errors to (or false to disable).
	 * @defaultValue console.log
	 */
	log: ((...args: any[]) => void) | false;
}

Readme

Keywords

none

Package Sidebar

Install

npm i node-keep

Weekly Downloads

0

Version

0.0.1

License

none

Unpacked Size

2.27 MB

Total Files

41

Last publish

Collaborators

  • azwiggin