level

  • Version 8.0.1
  • Published
  • 85.1 kB
  • 3 dependencies
  • MIT license

Install

npm i level
yarn add level
pnpm add level

Overview

Universal abstract-level database for Node.js and browsers

Index

Classes

class Level

class Level<
KDefault = string,
VDefault = string
> extends AbstractLevel.AbstractLevel<
string | Buffer | Uint8Array,
KDefault,
VDefault
> {}
  • Universal AbstractLevel database for Node.js and browsers.

    KDefault The default type of keys if not overridden on operations. VDefault The default type of values if not overridden on operations.

constructor

constructor(location: string, options?: any);
  • Database constructor.

    Parameter location

    Directory path (relative or absolute) where LevelDB will store its files, or in browsers, the name of the [IDBDatabase](https://developer.mozilla.org/en-US/docs/Web/API/IDBDatabase) to be opened.

    Parameter options

    Options, of which some will be forwarded to open.

property location

readonly location: string;
  • Location that was passed to the constructor.

method batch

batch: {
(
operations: Array<BatchOperation<typeof this, KDefault, VDefault>>
): Promise<void>;
(operations: any[], callback: AbstractLevel.NodeCallback<void>): void;
<K = KDefault, V = VDefault>(operations: any[], options: any): Promise<void>;
<K = KDefault, V = VDefault>(
operations: any[],
options: any,
callback: AbstractLevel.NodeCallback<void>
): void;
(): any;
};

    method del

    del: {
    (key: KDefault): Promise<void>;
    (key: KDefault, callback: AbstractLevel.NodeCallback<void>): void;
    <K = KDefault>(key: K, options: any): Promise<void>;
    <K = KDefault>(
    key: K,
    options: any,
    callback: AbstractLevel.NodeCallback<void>
    ): void;
    };

      method get

      get: {
      (key: KDefault): Promise<VDefault>;
      (key: KDefault, callback: AbstractLevel.NodeCallback<VDefault>): void;
      <K = KDefault, V = VDefault>(key: K, options: any): Promise<V>;
      <K = KDefault, V = VDefault>(
      key: K,
      options: any,
      callback: AbstractLevel.NodeCallback<V>
      ): void;
      };

        method getMany

        getMany: {
        (keys: KDefault[]): Promise<VDefault[]>;
        (keys: KDefault[], callback: AbstractLevel.NodeCallback<VDefault[]>): void;
        <K = KDefault, V = VDefault>(keys: K[], options: any): Promise<V[]>;
        <K = KDefault, V = VDefault>(
        keys: K[],
        options: any,
        callback: AbstractLevel.NodeCallback<V[]>
        ): void;
        };

          method iterator

          iterator: {
          (): Iterator<typeof this, KDefault, VDefault>;
          <K = KDefault, V = VDefault>(options: any): any;
          };

            method keys

            keys: {
            (): KeyIterator<typeof this, KDefault>;
            <K = KDefault>(options: any): any;
            };

              method open

              open: {
              (): Promise<void>;
              (options: any): Promise<void>;
              (callback: AbstractLevel.NodeCallback<void>): void;
              (options: any, callback: AbstractLevel.NodeCallback<void>): void;
              };

                method put

                put: {
                (key: KDefault, value: VDefault): Promise<void>;
                (
                key: KDefault,
                value: VDefault,
                callback: AbstractLevel.NodeCallback<void>
                ): void;
                <K = KDefault, V = VDefault>(key: K, value: V, options: any): Promise<void>;
                <K = KDefault, V = VDefault>(
                key: K,
                value: V,
                options: any,
                callback: AbstractLevel.NodeCallback<void>
                ): void;
                };

                  method values

                  values: {
                  (): ValueIterator<typeof this, KDefault, VDefault>;
                  <K = KDefault, V = VDefault>(options: any): any;
                  };

                    Type Aliases

                    type BatchOperation

                    type BatchOperation<TDatabase, K, V> = ClassicLevel.BatchOperation<TDatabase, K, V> &
                    BrowserLevel.BatchOperation<TDatabase, K, V>;

                      type BatchOptions

                      type BatchOptions<K, V> = ClassicLevel.BatchOptions<K, V> &
                      BrowserLevel.BatchOptions<K, V>;

                        type ChainedBatch

                        type ChainedBatch<TDatabase, K, V> = ClassicLevel.ChainedBatch<TDatabase, K, V> &
                        BrowserLevel.ChainedBatch<TDatabase, K, V>;

                          type DatabaseOptions

                          type DatabaseOptions<K, V> = ClassicLevel.DatabaseOptions<K, V> &
                          BrowserLevel.DatabaseOptions<K, V>;

                            type DelOptions

                            type DelOptions<K> = ClassicLevel.DelOptions<K> & BrowserLevel.DelOptions<K>;

                              type GetManyOptions

                              type GetManyOptions<K, V> = ClassicLevel.GetManyOptions<K, V> &
                              BrowserLevel.GetManyOptions<K, V>;

                                type GetOptions

                                type GetOptions<K, V> = ClassicLevel.GetOptions<K, V> &
                                BrowserLevel.GetOptions<K, V>;

                                  type Iterator

                                  type Iterator<TDatabase, K, V> = ClassicLevel.Iterator<TDatabase, K, V> &
                                  BrowserLevel.Iterator<TDatabase, K, V>;

                                    type IteratorOptions

                                    type IteratorOptions<K, V> = ClassicLevel.IteratorOptions<K, V> &
                                    BrowserLevel.IteratorOptions<K, V>;

                                      type KeyIterator

                                      type KeyIterator<TDatabase, K> = ClassicLevel.KeyIterator<TDatabase, K> &
                                      BrowserLevel.KeyIterator<TDatabase, K>;

                                        type KeyIteratorOptions

                                        type KeyIteratorOptions<K> = ClassicLevel.KeyIteratorOptions<K> &
                                        BrowserLevel.KeyIteratorOptions<K>;

                                          type OpenOptions

                                          type OpenOptions = ClassicLevel.OpenOptions & BrowserLevel.OpenOptions;

                                            type PutOptions

                                            type PutOptions<K, V> = ClassicLevel.PutOptions<K, V> &
                                            BrowserLevel.PutOptions<K, V>;

                                              type ValueIterator

                                              type ValueIterator<TDatabase, K, V> = ClassicLevel.ValueIterator<TDatabase, K, V> &
                                              BrowserLevel.ValueIterator<TDatabase, K, V>;

                                                type ValueIteratorOptions

                                                type ValueIteratorOptions<K, V> = ClassicLevel.ValueIteratorOptions<K, V> &
                                                BrowserLevel.ValueIteratorOptions<K, V>;

                                                  Package Files (1)

                                                  Dependencies (3)

                                                  Dev Dependencies (11)

                                                  Peer Dependencies (0)

                                                  No peer dependencies.

                                                  Badge

                                                  To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                  You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/level.

                                                  • Markdown
                                                    [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/level)
                                                  • HTML
                                                    <a href="https://www.jsdocs.io/package/level"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>