UNPKG

@types/encoding-down

Version:
72 lines (58 loc) 2.97 kB
# Installation > `npm install --save @types/encoding-down` # Summary This package contains type definitions for encoding-down (https://github.com/Level/encoding-down). # Details Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/encoding-down. ## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/encoding-down/index.d.ts) ````ts import { AbstractBatch, AbstractChainedBatch, AbstractGetOptions, AbstractIterator, AbstractIteratorOptions, AbstractLevelDOWN, AbstractOpenOptions, AbstractOptions, ErrorCallback, ErrorValueCallback, } from "abstract-leveldown"; import { CodecEncoder, CodecOptions } from "level-codec"; interface EncodingDown<K = any, V = any> extends AbstractLevelDOWN<K, V> { get(key: K, cb: ErrorValueCallback<V>): void; get(key: K, options: EncodingDown.GetOptions, cb: ErrorValueCallback<V>): void; put(key: K, value: V, cb: ErrorCallback): void; put(key: K, value: V, options: EncodingDown.PutOptions, cb: ErrorCallback): void; del(key: K, cb: ErrorCallback): void; del(key: K, options: EncodingDown.DelOptions, cb: ErrorCallback): void; batch(): EncodingDown.ChainedBatch; batch(array: AbstractBatch[], cb: ErrorCallback): EncodingDown.ChainedBatch; batch(array: AbstractBatch[], options: EncodingDown.BatchOptions, cb: ErrorCallback): EncodingDown.ChainedBatch; iterator(options?: EncodingDown.IteratorOptions): AbstractIterator<any, any>; } declare namespace EncodingDown { interface GetOptions extends AbstractGetOptions, CodecOptions {} interface PutOptions extends AbstractOptions, CodecOptions {} interface DelOptions extends AbstractOptions, CodecOptions {} interface BatchOptions extends AbstractOptions, CodecOptions {} interface IteratorOptions extends AbstractIteratorOptions, CodecOptions {} interface ChainedBatch<K = any, V = any> extends AbstractChainedBatch<K, V> { write(cb: any): any; write(options: CodecOptions & AbstractOptions, cb: any): any; } interface Constructor { // eslint-disable-next-line @definitelytyped/no-unnecessary-generics <K = any, V = any>(db: AbstractLevelDOWN, options?: CodecOptions): EncodingDown<K, V>; // eslint-disable-next-line @definitelytyped/no-unnecessary-generics new<K = any, V = any>(db: AbstractLevelDOWN, options?: CodecOptions): EncodingDown<K, V>; } } declare const EncodingDown: EncodingDown.Constructor; export default EncodingDown; ```` ### Additional Details * Last updated: Mon, 06 Nov 2023 22:41:05 GMT * Dependencies: [@types/abstract-leveldown](https://npmjs.com/package/@types/abstract-leveldown), [@types/level-codec](https://npmjs.com/package/@types/level-codec) # Credits These definitions were written by [Meirion Hughes](https://github.com/MeirionHughes), and [Daniel Byrne](https://github.com/danwbyrne).