# @types/subleveldown

> TypeScript definitions for subleveldown

Latest version **4.1.4** (published 2023-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/subleveldown
pnpm add @types/subleveldown
yarn add @types/subleveldown
bun add @types/subleveldown
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 4.1.4 |
| Published | 2023-11-07 |
| First published | 2019-12-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 6.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51442 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/subleveldown
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/subleveldown
- npm.io page: https://npm.io/package/@types/subleveldown

## Dependencies (3)

- [@types/levelup](https://npm.io/package/@types/levelup.md) *
- [@types/level-codec](https://npm.io/package/@types/level-codec.md) *
- [@types/abstract-leveldown](https://npm.io/package/@types/abstract-leveldown.md) *

## Recent versions

- 4.1.4 (latest) — 2023-11-07
- 4.1.1 (ts3.6) — 2021-07-02
- 4.1.0 (ts2.8) — 2019-12-26
- 4.1.3 — 2023-10-18
- 4.1.2 — 2023-09-25

## README

# Installation
> `npm install --save @types/subleveldown`

# Summary
This package contains type definitions for subleveldown (https://github.com/level/subleveldown).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/subleveldown.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/subleveldown/index.d.ts)
````ts
import { AbstractIterator, AbstractLevelDOWN, ErrorCallback } from "abstract-leveldown";
import { CodecOptions } from "level-codec";
import { LevelUp } from "levelup";

/** @see {@link SubDownOptions#open} */
type SubDownOpenHook = (callback: ErrorCallback) => void;

/**
 * Any other options are passed along to the underlying `levelup` and `encoding-down` constructors.
 * {@link https://github.com/Level/subleveldown#api See their documentation for further details}.
 */
interface SubDownOptions extends CodecOptions {
    /**
     * Character for separating sublevel prefixes from user keys and each other. Should be outside the character (or byte) range of user keys.
     * @default '!'
     */
    separator?: string | undefined;

    /**
     * Optional open hook called when the underlying `levelup` instance has been opened.
     * The hook receives a callback which must be called to finish opening.
     */
    open?: SubDownOpenHook | undefined;

    // TODO: Remove and inherit from constructor options from levelup package
    [key: string]: any;
}

/**
 * Returns a `levelup` instance that uses subleveldown to prefix the keys of the underlying store of `db`.
 * Any layers that this instance may have (like `encoding-down` or `subleveldown` itself) are peeled off to get to the innermost `abstract-leveldown` compliant store (like `leveldown`).
 * This ensures there is no double encoding step.
 * @param db
 * @param prefix If omitted, the effective prefix is two separators, e.g. `'!!'`. If `db` is already a subleveldown-powered instance, the effective prefix is a combined prefix, e.g. `'!one!!two!'`.
 * @param opts
 * @see {@link https://github.com/Level/subleveldown#api subleveldown API}
 */
declare function sub<K = any, V = any>(
    db: LevelUp,
    prefix?: string,
    opts?: SubDownOptions | string,
): LevelUp<AbstractLevelDOWN<K, V>, AbstractIterator<K, V>>;
declare namespace sub {}

export = sub;

````

### Additional Details
 * Last updated: Tue, 07 Nov 2023 15:11:36 GMT
 * Dependencies: [@types/abstract-leveldown](https://npmjs.com/package/@types/abstract-leveldown), [@types/level-codec](https://npmjs.com/package/@types/level-codec), [@types/levelup](https://npmjs.com/package/@types/levelup)

# Credits
These definitions were written by [Carson Farmer](https://github.com/carsonfarmer), and [Dmitry Demensky](https://github.com/demensky).

---
_Source: https://npm.io/package/@types/subleveldown · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
