mirror of
https://github.com/fluencelabs/libp2p-ts
synced 2025-06-13 13:01:21 +00:00
Add memdown
This commit is contained in:
4
blakejs/index.d.ts
vendored
4
blakejs/index.d.ts
vendored
@ -14,7 +14,7 @@ type BlakeJsContext = {
|
|||||||
outlen: number
|
outlen: number
|
||||||
};
|
};
|
||||||
|
|
||||||
type blakejs = {
|
interface blakejs {
|
||||||
blake2b: (data: Buffer | Uint8Array | string, key?: Uint8Array | null, outlen?: number) => Uint8Array,
|
blake2b: (data: Buffer | Uint8Array | string, key?: Uint8Array | null, outlen?: number) => Uint8Array,
|
||||||
blake2bFinal: (context: BlakeJsContext) => Uint8Array,
|
blake2bFinal: (context: BlakeJsContext) => Uint8Array,
|
||||||
blake2bHex: (data: Buffer | Uint8Array | string, key?: Uint8Array | null, outlen?: number) => string,
|
blake2bHex: (data: Buffer | Uint8Array | string, key?: Uint8Array | null, outlen?: number) => string,
|
||||||
@ -25,7 +25,7 @@ type blakejs = {
|
|||||||
blake2sHex: (data: Buffer | Uint8Array | string, key?: Uint8Array | null, outlen?: number) => string,
|
blake2sHex: (data: Buffer | Uint8Array | string, key?: Uint8Array | null, outlen?: number) => string,
|
||||||
blake2sInit: (outlen?: number, key?: Uint8Array) => BlakeJsContext,
|
blake2sInit: (outlen?: number, key?: Uint8Array) => BlakeJsContext,
|
||||||
blake2sUpdate: (context: BlakeJsContext, data: Buffer | Uint8Array | string) => void
|
blake2sUpdate: (context: BlakeJsContext, data: Buffer | Uint8Array | string) => void
|
||||||
};
|
}
|
||||||
|
|
||||||
export = blakejs;
|
export = blakejs;
|
||||||
}
|
}
|
||||||
|
21
memdown/LICENSE
Normal file
21
memdown/LICENSE
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE
|
16
memdown/README.md
Normal file
16
memdown/README.md
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# Installation
|
||||||
|
> `npm install --save @types/leveldown`
|
||||||
|
|
||||||
|
# Summary
|
||||||
|
This package contains type definitions for LevelDown (https://github.com/level/leveldown).
|
||||||
|
|
||||||
|
# Details
|
||||||
|
Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/leveldown
|
||||||
|
|
||||||
|
Additional Details
|
||||||
|
* Last updated: Fri, 05 May 2017 04:05:52 GMT
|
||||||
|
* Dependencies: node
|
||||||
|
* Global values: none
|
||||||
|
|
||||||
|
# Credits
|
||||||
|
These definitions were written by Thiago de Arruda <https://github.com/tarruda>.
|
148
memdown/index.d.ts
vendored
Normal file
148
memdown/index.d.ts
vendored
Normal file
@ -0,0 +1,148 @@
|
|||||||
|
// Type definitions for LevelDown 3.0.0
|
||||||
|
// Project: https://github.com/level/memdown
|
||||||
|
// Definitions by: Thiago de Arruda <https://github.com/tarruda>
|
||||||
|
// Jaco Greeff <https://github.com/jacogr>
|
||||||
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||||
|
|
||||||
|
/// <reference types="node" />
|
||||||
|
|
||||||
|
declare module 'memdown' {
|
||||||
|
export = memdown;
|
||||||
|
|
||||||
|
var memdown: memdown.Constructor;
|
||||||
|
|
||||||
|
namespace memdown {
|
||||||
|
type Bytes = string | Buffer;
|
||||||
|
type ErrCallback = (error: any) => void;
|
||||||
|
type ErrNumberCallback = (error: any, value: number) => void;
|
||||||
|
type ErrBufferCallback = (error: any, value: Buffer) => void;
|
||||||
|
type ErrStringCallback = (error: any, value: string) => void;
|
||||||
|
type KeyAsStringCallback = (error: any, key: string, value: Buffer) => void;
|
||||||
|
type ValueAsStringCallback = (error: any, key: Buffer, value: string) => void;
|
||||||
|
type KeyAndValueAsStringCallback = (error: any, key: string, value: string) => void;
|
||||||
|
type KeyAndValueAsBufferCallback = (error: any, key: Buffer, value: Buffer) => void;
|
||||||
|
|
||||||
|
interface PutBatch {
|
||||||
|
type: "put";
|
||||||
|
key: Bytes;
|
||||||
|
value: Bytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface DelBatch {
|
||||||
|
type: "del";
|
||||||
|
key: Bytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
type Batch = PutBatch | DelBatch;
|
||||||
|
|
||||||
|
interface OpenOptions {
|
||||||
|
createIfMissing?: boolean;
|
||||||
|
errorIfExists?: boolean;
|
||||||
|
compression?: boolean;
|
||||||
|
cacheSize?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface OpenAdvancedOptions extends OpenOptions {
|
||||||
|
writeBufferSize?: number;
|
||||||
|
blockSize?: number;
|
||||||
|
maxOpenFiles?: number;
|
||||||
|
blockRestartInterval?: number;
|
||||||
|
maxFileSize?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface WriteOptions {
|
||||||
|
sync?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ReadOptions {
|
||||||
|
fillCache?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface BufferReadOptions extends ReadOptions {
|
||||||
|
asBuffer?: true;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface StringReadOptions extends ReadOptions {
|
||||||
|
asBuffer: false;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IteratorOptions {
|
||||||
|
gt?: Bytes;
|
||||||
|
lt?: Bytes;
|
||||||
|
gte?: Bytes;
|
||||||
|
lte?: Bytes;
|
||||||
|
reverse?: boolean;
|
||||||
|
keys?: boolean;
|
||||||
|
values?: boolean;
|
||||||
|
limit?: number;
|
||||||
|
fillCache?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface KeyAsStringIteratorOptions extends IteratorOptions {
|
||||||
|
keyAsBuffer: false;
|
||||||
|
valueAsBuffer?: true;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ValueAsStringIteratorOptions extends IteratorOptions {
|
||||||
|
keyAsBuffer?: true;
|
||||||
|
valueAsBuffer: false;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface KeyAndValueAsStringIteratorOptions extends IteratorOptions {
|
||||||
|
keyAsBuffer: false;
|
||||||
|
valueAsBuffer: false;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface KeyAndValueAsBufferIteratorOptions extends IteratorOptions {
|
||||||
|
keyAsBuffer?: true;
|
||||||
|
valueAsBuffer?: true;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Iterator {
|
||||||
|
seek(key: Bytes): void;
|
||||||
|
end(callback: ErrCallback): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface KeyAsStringIterator extends Iterator {
|
||||||
|
next(callback: KeyAsStringCallback): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ValueAsStringIterator extends Iterator {
|
||||||
|
next(callback: ValueAsStringCallback): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface KeyAndValueAsStringIterator extends Iterator {
|
||||||
|
next(callback: KeyAndValueAsStringCallback): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface KeyAndValueAsBufferIterator extends Iterator {
|
||||||
|
next(callback: KeyAndValueAsBufferCallback): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface MemDown {
|
||||||
|
open(callback: ErrCallback): void;
|
||||||
|
open(options: OpenOptions, callback: ErrCallback): void;
|
||||||
|
close(callback?: ErrCallback): void;
|
||||||
|
put(key: Bytes, value: Bytes, callback: ErrCallback): void;
|
||||||
|
put(key: Bytes, value: Bytes, options: WriteOptions, callback: ErrCallback): void;
|
||||||
|
get(key: Bytes, callback: ErrBufferCallback): void;
|
||||||
|
get(key: Bytes, options: BufferReadOptions, callback: ErrBufferCallback): void;
|
||||||
|
get(key: Bytes, options: StringReadOptions, callback: ErrStringCallback): void;
|
||||||
|
del(key: Bytes, callback?: ErrCallback): void;
|
||||||
|
del(key: Bytes, options: WriteOptions, callback?: ErrCallback): void;
|
||||||
|
batch(operations: Batch[], callback?: ErrCallback): void;
|
||||||
|
batch(operations: Batch[], options?: WriteOptions, callback?: ErrCallback): void;
|
||||||
|
approximateSize(start: Bytes, end: Bytes, callback: ErrNumberCallback): void;
|
||||||
|
compactRange(start: Bytes, end: Bytes, callback: ErrCallback): void;
|
||||||
|
getProperty(property: string): string;
|
||||||
|
iterator(options?: KeyAsStringIteratorOptions): KeyAsStringIterator;
|
||||||
|
iterator(options?: ValueAsStringIteratorOptions): ValueAsStringIterator;
|
||||||
|
iterator(options?: KeyAndValueAsStringIteratorOptions): KeyAndValueAsStringIterator;
|
||||||
|
iterator(options?: KeyAndValueAsBufferIteratorOptions): KeyAndValueAsBufferIterator;
|
||||||
|
destroy(location: string, callback: ErrCallback): void;
|
||||||
|
repair(location: string, callback: ErrCallback): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
type Constructor = () => MemDown;
|
||||||
|
}
|
||||||
|
}
|
24
memdown/package.json
Normal file
24
memdown/package.json
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"name": "@types/leveldown",
|
||||||
|
"version": "1.7.0",
|
||||||
|
"description": "TypeScript definitions for LevelDown",
|
||||||
|
"license": "MIT",
|
||||||
|
"contributors": [
|
||||||
|
{
|
||||||
|
"name": "Thiago de Arruda",
|
||||||
|
"url": "https://github.com/tarruda"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"main": "",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://www.github.com/DefinitelyTyped/DefinitelyTyped.git"
|
||||||
|
},
|
||||||
|
"scripts": {},
|
||||||
|
"dependencies": {
|
||||||
|
"@types/node": "*"
|
||||||
|
},
|
||||||
|
"peerDependencies": {},
|
||||||
|
"typesPublisherContentHash": "8ad2a943006b3c5296b92869b9a520d84e733c731edabe2e500821f18f35b56f",
|
||||||
|
"typeScriptVersion": "2.0"
|
||||||
|
}
|
Reference in New Issue
Block a user