@types/level-codec
Version:
TypeScript definitions for level-codec
47 lines (40 loc) • 1.54 kB
Markdown
# Installation
> `npm install --save @types/level-codec`
# Summary
This package contains type definitions for level-codec (https://github.com/Level/codec).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/level-codec.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/level-codec/index.d.ts)
````ts
export interface CodecEncoder {
encode: (val: any) => any;
decode: (val: any) => any;
buffer: boolean;
type: string;
}
export interface CodecOptions {
keyEncoding?: string | CodecEncoder | undefined;
valueEncoding?: string | CodecEncoder | undefined;
}
export interface Codec {
encodeKey(key: any, opts?: CodecOptions, batchOpts?: CodecOptions): any;
encodeValue(value: any, opts?: CodecOptions, batchOpts?: CodecOptions): any;
decodeKey(key: any, opts?: CodecOptions): any;
decodeValue(value: any, opts?: CodecOptions): any;
encodeBatch(ops: any, opts?: CodecOptions): any;
encodeLtgt(ltgt: any): any;
createStreamDecoder(opts: CodecOptions): any;
keyAsBuffer(opts?: CodecOptions): any;
valueAsBuffer(opts?: CodecOptions): any;
}
export interface CodecConstructor {
new(options?: CodecOptions): Codec;
(options?: CodecOptions): Codec;
}
export const Codec: CodecConstructor;
````
### Additional Details
* Last updated: Tue, 07 Nov 2023 09:09:38 GMT
* Dependencies: none
# Credits
These definitions were written by [Daniel Byrne](https://github.com/danwbyrne).