extra-disk-store 0.4.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/lib/converters/index-key-converter.d.ts +1 -1
- package/lib/converters/index-key-converter.js +1 -5
- package/lib/converters/index-key-converter.js.map +1 -1
- package/lib/converters/index.d.ts +8 -8
- package/lib/converters/index.js +8 -24
- package/lib/converters/index.js.map +1 -1
- package/lib/converters/json-key-converter.d.ts +1 -1
- package/lib/converters/json-key-converter.js +1 -5
- package/lib/converters/json-key-converter.js.map +1 -1
- package/lib/converters/json-value-converter.d.ts +2 -2
- package/lib/converters/json-value-converter.js +1 -5
- package/lib/converters/json-value-converter.js.map +1 -1
- package/lib/converters/lz4-value-converter.d.ts +2 -2
- package/lib/converters/lz4-value-converter.js +2 -29
- package/lib/converters/lz4-value-converter.js.map +1 -1
- package/lib/converters/passthrough-key-converter.d.ts +1 -1
- package/lib/converters/passthrough-key-converter.js +1 -5
- package/lib/converters/passthrough-key-converter.js.map +1 -1
- package/lib/converters/passthrough-value-converter.d.ts +2 -2
- package/lib/converters/passthrough-value-converter.js +1 -5
- package/lib/converters/passthrough-value-converter.js.map +1 -1
- package/lib/converters/prefix-key-converter.d.ts +1 -1
- package/lib/converters/prefix-key-converter.js +1 -5
- package/lib/converters/prefix-key-converter.js.map +1 -1
- package/lib/converters/zstandard-value-converter.d.ts +2 -2
- package/lib/converters/zstandard-value-converter.js +2 -29
- package/lib/converters/zstandard-value-converter.js.map +1 -1
- package/lib/disk-store-view.d.ts +3 -3
- package/lib/disk-store-view.js +5 -9
- package/lib/disk-store-view.js.map +1 -1
- package/lib/disk-store-with-cache.d.ts +2 -2
- package/lib/disk-store-with-cache.js +4 -8
- package/lib/disk-store-with-cache.js.map +1 -1
- package/lib/disk-store.d.ts +2 -2
- package/lib/disk-store.js +9 -39
- package/lib/disk-store.js.map +1 -1
- package/lib/index.d.ts +4 -4
- package/lib/index.js +4 -23
- package/lib/index.js.map +1 -1
- package/lib/types.d.ts +1 -1
- package/lib/types.js +1 -2
- package/package.json +31 -28
- package/src/converters/index-key-converter.ts +13 -0
- package/src/converters/index.ts +11 -0
- package/src/converters/json-key-converter.ts +11 -0
- package/src/converters/json-value-converter.ts +13 -0
- package/src/converters/lz4-value-converter.ts +18 -0
- package/src/converters/passthrough-key-converter.ts +11 -0
- package/src/converters/passthrough-value-converter.ts +11 -0
- package/src/converters/prefix-key-converter.ts +22 -0
- package/src/converters/zstandard-value-converter.ts +19 -0
- package/src/disk-store-view.ts +62 -0
- package/src/disk-store-with-cache.ts +78 -0
- package/src/disk-store.ts +59 -0
- package/src/index.ts +4 -0
- package/src/types.ts +18 -0
package/README.md
CHANGED
|
@@ -8,6 +8,13 @@ npm install --save extra-disk-store
|
|
|
8
8
|
yarn add extra-disk-store
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
## Limitations
|
|
12
|
+
This library uses [lmdb] as the storage layer for performance reasons.
|
|
13
|
+
Unfortunately, lmdb only supports keys of limited size (1978 bytes),
|
|
14
|
+
so make sure you only use this library for scenarios with limited key size.
|
|
15
|
+
|
|
16
|
+
[lmdb]: https://www.npmjs.org/package/lmdb
|
|
17
|
+
|
|
11
18
|
## Usage
|
|
12
19
|
```ts
|
|
13
20
|
import { DiskStore } from 'extra-disk-store'
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IndexKeyConverter = void 0;
|
|
4
|
-
class IndexKeyConverter {
|
|
1
|
+
export class IndexKeyConverter {
|
|
5
2
|
constructor(radix = 10) {
|
|
6
3
|
this.radix = radix;
|
|
7
4
|
}
|
|
@@ -12,5 +9,4 @@ class IndexKeyConverter {
|
|
|
12
9
|
return Number.parseInt(value, this.radix);
|
|
13
10
|
}
|
|
14
11
|
}
|
|
15
|
-
exports.IndexKeyConverter = IndexKeyConverter;
|
|
16
12
|
//# sourceMappingURL=index-key-converter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-key-converter.js","sourceRoot":"","sources":["../../src/converters/index-key-converter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index-key-converter.js","sourceRoot":"","sources":["../../src/converters/index-key-converter.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,iBAAiB;IAC5B,YAAoB,QAAgB,EAAE;QAAlB,UAAK,GAAL,KAAK,CAAa;IAAG,CAAC;IAE1C,QAAQ,CAAC,KAAa;QACpB,OAAO,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IACnC,CAAC;IAED,UAAU,CAAC,KAAa;QACtB,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAA;IAC3C,CAAC;CACF"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export * from './json-key-converter';
|
|
2
|
-
export * from './json-value-converter';
|
|
3
|
-
export * from './passthrough-key-converter';
|
|
4
|
-
export * from './passthrough-value-converter';
|
|
5
|
-
export * from './index-key-converter';
|
|
6
|
-
export * from './prefix-key-converter';
|
|
7
|
-
export * from './lz4-value-converter';
|
|
8
|
-
export * from './zstandard-value-converter';
|
|
1
|
+
export * from './json-key-converter.js';
|
|
2
|
+
export * from './json-value-converter.js';
|
|
3
|
+
export * from './passthrough-key-converter.js';
|
|
4
|
+
export * from './passthrough-value-converter.js';
|
|
5
|
+
export * from './index-key-converter.js';
|
|
6
|
+
export * from './prefix-key-converter.js';
|
|
7
|
+
export * from './lz4-value-converter.js';
|
|
8
|
+
export * from './zstandard-value-converter.js';
|
package/lib/converters/index.js
CHANGED
|
@@ -1,25 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./json-key-converter"), exports);
|
|
18
|
-
__exportStar(require("./json-value-converter"), exports);
|
|
19
|
-
__exportStar(require("./passthrough-key-converter"), exports);
|
|
20
|
-
__exportStar(require("./passthrough-value-converter"), exports);
|
|
21
|
-
__exportStar(require("./index-key-converter"), exports);
|
|
22
|
-
__exportStar(require("./prefix-key-converter"), exports);
|
|
23
|
-
__exportStar(require("./lz4-value-converter"), exports);
|
|
24
|
-
__exportStar(require("./zstandard-value-converter"), exports);
|
|
1
|
+
export * from './json-key-converter.js';
|
|
2
|
+
export * from './json-value-converter.js';
|
|
3
|
+
export * from './passthrough-key-converter.js';
|
|
4
|
+
export * from './passthrough-value-converter.js';
|
|
5
|
+
export * from './index-key-converter.js';
|
|
6
|
+
export * from './prefix-key-converter.js';
|
|
7
|
+
export * from './lz4-value-converter.js';
|
|
8
|
+
export * from './zstandard-value-converter.js';
|
|
25
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/converters/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/converters/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AACvC,cAAc,2BAA2B,CAAA;AAEzC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,kCAAkC,CAAA;AAEhD,cAAc,0BAA0B,CAAA;AACxC,cAAc,2BAA2B,CAAA;AAEzC,cAAc,0BAA0B,CAAA;AACxC,cAAc,gCAAgC,CAAA"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.JSONKeyConverter = void 0;
|
|
4
|
-
class JSONKeyConverter {
|
|
1
|
+
export class JSONKeyConverter {
|
|
5
2
|
fromString(value) {
|
|
6
3
|
return JSON.parse(value);
|
|
7
4
|
}
|
|
@@ -9,5 +6,4 @@ class JSONKeyConverter {
|
|
|
9
6
|
return JSON.stringify(value);
|
|
10
7
|
}
|
|
11
8
|
}
|
|
12
|
-
exports.JSONKeyConverter = JSONKeyConverter;
|
|
13
9
|
//# sourceMappingURL=json-key-converter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-key-converter.js","sourceRoot":"","sources":["../../src/converters/json-key-converter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"json-key-converter.js","sourceRoot":"","sources":["../../src/converters/json-key-converter.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,gBAAgB;IAC3B,UAAU,CAAC,KAAa;QACtB,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IAC1B,CAAC;IAED,QAAQ,CAAC,KAAQ;QACf,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;IAC9B,CAAC;CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { IValueConverter } from "../types";
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
import { IValueConverter } from "../types.js";
|
|
3
3
|
export declare class JSONValueConverter<T> implements IValueConverter<T> {
|
|
4
4
|
private encoding;
|
|
5
5
|
constructor(encoding?: BufferEncoding);
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.JSONValueConverter = void 0;
|
|
4
|
-
class JSONValueConverter {
|
|
1
|
+
export class JSONValueConverter {
|
|
5
2
|
constructor(encoding = 'utf-8') {
|
|
6
3
|
this.encoding = encoding;
|
|
7
4
|
}
|
|
@@ -12,5 +9,4 @@ class JSONValueConverter {
|
|
|
12
9
|
return Buffer.from(JSON.stringify(value), this.encoding);
|
|
13
10
|
}
|
|
14
11
|
}
|
|
15
|
-
exports.JSONValueConverter = JSONValueConverter;
|
|
16
12
|
//# sourceMappingURL=json-value-converter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-value-converter.js","sourceRoot":"","sources":["../../src/converters/json-value-converter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"json-value-converter.js","sourceRoot":"","sources":["../../src/converters/json-value-converter.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,kBAAkB;IAC7B,YAAoB,WAA2B,OAAO;QAAlC,aAAQ,GAAR,QAAQ,CAA0B;IAAG,CAAC;IAE1D,UAAU,CAAC,MAAc;QACvB,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAA;IACnD,CAAC;IAED,QAAQ,CAAC,KAAQ;QACf,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;IAC1D,CAAC;CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { IValueConverter } from "../types";
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
import { IValueConverter } from "../types.js";
|
|
3
3
|
export declare class LZ4ValueConverter<T> implements IValueConverter<T> {
|
|
4
4
|
private valueConverter;
|
|
5
5
|
constructor(valueConverter: IValueConverter<T>);
|
|
@@ -1,31 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.LZ4ValueConverter = void 0;
|
|
27
|
-
const lz4 = __importStar(require("lz4-wasm-nodejs"));
|
|
28
|
-
class LZ4ValueConverter {
|
|
1
|
+
import * as lz4 from 'lz4-wasm-nodejs';
|
|
2
|
+
export class LZ4ValueConverter {
|
|
29
3
|
constructor(valueConverter) {
|
|
30
4
|
this.valueConverter = valueConverter;
|
|
31
5
|
}
|
|
@@ -38,5 +12,4 @@ class LZ4ValueConverter {
|
|
|
38
12
|
return await this.valueConverter.fromBuffer(buffer);
|
|
39
13
|
}
|
|
40
14
|
}
|
|
41
|
-
exports.LZ4ValueConverter = LZ4ValueConverter;
|
|
42
15
|
//# sourceMappingURL=lz4-value-converter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lz4-value-converter.js","sourceRoot":"","sources":["../../src/converters/lz4-value-converter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lz4-value-converter.js","sourceRoot":"","sources":["../../src/converters/lz4-value-converter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,iBAAiB,CAAA;AAGtC,MAAM,OAAO,iBAAiB;IAC5B,YACU,cAAkC;QAAlC,mBAAc,GAAd,cAAc,CAAoB;IACzC,CAAC;IAEJ,KAAK,CAAC,QAAQ,CAAC,KAAQ;QACrB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;QACxD,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAA;IAC1C,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,KAAa;QAC5B,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAA;QACjD,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;IACrD,CAAC;CACF"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PassthroughKeyConverter = void 0;
|
|
4
|
-
class PassthroughKeyConverter {
|
|
1
|
+
export class PassthroughKeyConverter {
|
|
5
2
|
toString(value) {
|
|
6
3
|
return value;
|
|
7
4
|
}
|
|
@@ -9,5 +6,4 @@ class PassthroughKeyConverter {
|
|
|
9
6
|
return value;
|
|
10
7
|
}
|
|
11
8
|
}
|
|
12
|
-
exports.PassthroughKeyConverter = PassthroughKeyConverter;
|
|
13
9
|
//# sourceMappingURL=passthrough-key-converter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"passthrough-key-converter.js","sourceRoot":"","sources":["../../src/converters/passthrough-key-converter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"passthrough-key-converter.js","sourceRoot":"","sources":["../../src/converters/passthrough-key-converter.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,uBAAuB;IAClC,QAAQ,CAAC,KAAa;QACpB,OAAO,KAAK,CAAA;IACd,CAAC;IAED,UAAU,CAAC,KAAa;QACtB,OAAO,KAAK,CAAA;IACd,CAAC;CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { IValueConverter } from "../types";
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
import { IValueConverter } from "../types.js";
|
|
3
3
|
export declare class PassthroughValueConverter implements IValueConverter<Buffer> {
|
|
4
4
|
toBuffer(value: Buffer): Buffer;
|
|
5
5
|
fromBuffer(value: Buffer): Buffer;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PassthroughValueConverter = void 0;
|
|
4
|
-
class PassthroughValueConverter {
|
|
1
|
+
export class PassthroughValueConverter {
|
|
5
2
|
toBuffer(value) {
|
|
6
3
|
return value;
|
|
7
4
|
}
|
|
@@ -9,5 +6,4 @@ class PassthroughValueConverter {
|
|
|
9
6
|
return value;
|
|
10
7
|
}
|
|
11
8
|
}
|
|
12
|
-
exports.PassthroughValueConverter = PassthroughValueConverter;
|
|
13
9
|
//# sourceMappingURL=passthrough-value-converter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"passthrough-value-converter.js","sourceRoot":"","sources":["../../src/converters/passthrough-value-converter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"passthrough-value-converter.js","sourceRoot":"","sources":["../../src/converters/passthrough-value-converter.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,yBAAyB;IACpC,QAAQ,CAAC,KAAa;QACpB,OAAO,KAAK,CAAA;IACd,CAAC;IAED,UAAU,CAAC,KAAa;QACtB,OAAO,KAAK,CAAA;IACd,CAAC;CACF"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PrefixKeyConverter = void 0;
|
|
4
|
-
class PrefixKeyConverter {
|
|
1
|
+
export class PrefixKeyConverter {
|
|
5
2
|
constructor(keyConverter, prefix) {
|
|
6
3
|
this.keyConverter = keyConverter;
|
|
7
4
|
this.prefix = prefix;
|
|
@@ -20,5 +17,4 @@ class PrefixKeyConverter {
|
|
|
20
17
|
}
|
|
21
18
|
}
|
|
22
19
|
}
|
|
23
|
-
exports.PrefixKeyConverter = PrefixKeyConverter;
|
|
24
20
|
//# sourceMappingURL=prefix-key-converter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefix-key-converter.js","sourceRoot":"","sources":["../../src/converters/prefix-key-converter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prefix-key-converter.js","sourceRoot":"","sources":["../../src/converters/prefix-key-converter.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,kBAAkB;IAC7B,YACU,YAA8B,EAC9B,MAAc;QADd,iBAAY,GAAZ,YAAY,CAAkB;QAC9B,WAAM,GAAN,MAAM,CAAQ;IACrB,CAAC;IAEJ,KAAK,CAAC,QAAQ,CAAC,KAAQ;QACrB,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;QACnD,OAAO,IAAI,CAAC,MAAM,GAAG,GAAG,CAAA;IAC1B,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,KAAa;QAC5B,IAAI,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;YACjC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAA;YAC/E,OAAO,GAAG,CAAA;SACX;aAAM;YACL,OAAO,SAAS,CAAA;SACjB;IACH,CAAC;CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { IValueConverter } from "../types";
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
import { IValueConverter } from "../types.js";
|
|
3
3
|
export declare class ZstandardValueConverter<T> implements IValueConverter<T> {
|
|
4
4
|
private valueConverter;
|
|
5
5
|
private level;
|
|
@@ -1,31 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.ZstandardValueConverter = void 0;
|
|
27
|
-
const zstd = __importStar(require("@mongodb-js/zstd"));
|
|
28
|
-
class ZstandardValueConverter {
|
|
1
|
+
import * as zstd from '@mongodb-js/zstd';
|
|
2
|
+
export class ZstandardValueConverter {
|
|
29
3
|
constructor(valueConverter, level) {
|
|
30
4
|
this.valueConverter = valueConverter;
|
|
31
5
|
this.level = level;
|
|
@@ -39,5 +13,4 @@ class ZstandardValueConverter {
|
|
|
39
13
|
return await this.valueConverter.fromBuffer(buffer);
|
|
40
14
|
}
|
|
41
15
|
}
|
|
42
|
-
exports.ZstandardValueConverter = ZstandardValueConverter;
|
|
43
16
|
//# sourceMappingURL=zstandard-value-converter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zstandard-value-converter.js","sourceRoot":"","sources":["../../src/converters/zstandard-value-converter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"zstandard-value-converter.js","sourceRoot":"","sources":["../../src/converters/zstandard-value-converter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAA;AAGxC,MAAM,OAAO,uBAAuB;IAClC,YACU,cAAkC,EAClC,KAAa;QADb,mBAAc,GAAd,cAAc,CAAoB;QAClC,UAAK,GAAL,KAAK,CAAQ;IACpB,CAAC;IAEJ,KAAK,CAAC,QAAQ,CAAC,KAAQ;QACrB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;QACxD,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAA;IAC7D,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,KAAa;QAC5B,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAA;QACxD,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;IACrD,CAAC;CACF"}
|
package/lib/disk-store-view.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { DiskStore } from "./disk-store";
|
|
3
|
-
import { DiskStoreWithCache } from "./disk-store-with-cache";
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
import { DiskStore } from "./disk-store.js";
|
|
3
|
+
import { DiskStoreWithCache } from "./disk-store-with-cache.js";
|
|
4
4
|
import { Awaitable } from '@blackglory/prelude';
|
|
5
5
|
export interface IKeyConverter<T> {
|
|
6
6
|
toString: (value: T) => Awaitable<string>;
|
package/lib/disk-store-view.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const iterable_operator_1 = require("iterable-operator");
|
|
6
|
-
const prelude_1 = require("@blackglory/prelude");
|
|
7
|
-
class DiskStoreView {
|
|
1
|
+
import { pipe } from 'extra-utils';
|
|
2
|
+
import { mapAsync, filterAsync } from 'iterable-operator';
|
|
3
|
+
import { isntUndefined } from '@blackglory/prelude';
|
|
4
|
+
export class DiskStoreView {
|
|
8
5
|
constructor(store, keyConverter, valueConverter) {
|
|
9
6
|
this.store = store;
|
|
10
7
|
this.keyConverter = keyConverter;
|
|
@@ -35,8 +32,7 @@ class DiskStoreView {
|
|
|
35
32
|
await this.store.clear();
|
|
36
33
|
}
|
|
37
34
|
keys() {
|
|
38
|
-
return
|
|
35
|
+
return pipe(this.store.keys(), iter => mapAsync(iter, async (key) => await this.keyConverter.fromString(key)), iter => filterAsync(iter, isntUndefined));
|
|
39
36
|
}
|
|
40
37
|
}
|
|
41
|
-
exports.DiskStoreView = DiskStoreView;
|
|
42
38
|
//# sourceMappingURL=disk-store-view.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"disk-store-view.js","sourceRoot":"","sources":["../src/disk-store-view.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"disk-store-view.js","sourceRoot":"","sources":["../src/disk-store-view.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAClC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACzD,OAAO,EAAa,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAY9D,MAAM,OAAO,aAAa;IACxB,YACU,KAAqC,EACrC,YAA8B,EAC9B,cAAkC;QAFlC,UAAK,GAAL,KAAK,CAAgC;QACrC,iBAAY,GAAZ,YAAY,CAAkB;QAC9B,mBAAc,GAAd,cAAc,CAAoB;IACzC,CAAC;IAEJ,KAAK,CAAC,GAAG,CAAC,GAAM;QACd,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAA;IAC9D,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,GAAM;QACd,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAA;QAEpE,IAAI,MAAM,EAAE;YACV,OAAO,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;SAC9C;aAAM;YACL,OAAO,SAAS,CAAA;SACjB;IACH,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,GAAM,EAAE,KAAQ;QACxB,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAClB,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YACnB,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC;YACrC,MAAM,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC;SAC1C,CAAC,CACH,CAAA;IACH,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,GAAM;QACjB,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAA;IAChE,CAAC;IAED,KAAK,CAAC,KAAK;QACT,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;IAC1B,CAAC;IAED,IAAI;QACF,OAAO,IAAI,CACT,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,EACjB,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAC,GAAG,EAAC,EAAE,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,EAC5E,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,IAAI,EAAE,aAAa,CAAC,CACzC,CAAA;IACH,CAAC;CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { DiskStore } from './disk-store';
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
import { DiskStore } from './disk-store.js';
|
|
3
3
|
export interface ICache {
|
|
4
4
|
set(key: string, value: Buffer | false): void;
|
|
5
5
|
get(key: string): Buffer | false | undefined;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.DiskStoreWithCache = void 0;
|
|
4
|
-
const prelude_1 = require("@blackglory/prelude");
|
|
5
|
-
class DiskStoreWithCache {
|
|
1
|
+
import { isntUndefined } from '@blackglory/prelude';
|
|
2
|
+
export class DiskStoreWithCache {
|
|
6
3
|
constructor(store, cache) {
|
|
7
4
|
this.store = store;
|
|
8
5
|
this.cache = cache;
|
|
@@ -15,7 +12,7 @@ class DiskStoreWithCache {
|
|
|
15
12
|
if (result === false) {
|
|
16
13
|
return result;
|
|
17
14
|
}
|
|
18
|
-
else if (
|
|
15
|
+
else if (isntUndefined(result)) {
|
|
19
16
|
return true;
|
|
20
17
|
}
|
|
21
18
|
else {
|
|
@@ -35,7 +32,7 @@ class DiskStoreWithCache {
|
|
|
35
32
|
if (result === false) {
|
|
36
33
|
return undefined;
|
|
37
34
|
}
|
|
38
|
-
else if (
|
|
35
|
+
else if (isntUndefined(result)) {
|
|
39
36
|
return result;
|
|
40
37
|
}
|
|
41
38
|
else {
|
|
@@ -66,5 +63,4 @@ class DiskStoreWithCache {
|
|
|
66
63
|
return this.store.keys();
|
|
67
64
|
}
|
|
68
65
|
}
|
|
69
|
-
exports.DiskStoreWithCache = DiskStoreWithCache;
|
|
70
66
|
//# sourceMappingURL=disk-store-with-cache.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"disk-store-with-cache.js","sourceRoot":"","sources":["../src/disk-store-with-cache.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"disk-store-with-cache.js","sourceRoot":"","sources":["../src/disk-store-with-cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAUnD,MAAM,OAAO,kBAAkB;IAC7B,YACU,KAAgB,EAChB,KAAa;QADb,UAAK,GAAL,KAAK,CAAW;QAChB,UAAK,GAAL,KAAK,CAAQ;IACpB,CAAC;IAEJ,KAAK,CAAC,KAAK;QACT,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;IAC1B,CAAC;IAED,GAAG,CAAC,GAAW;QACb,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QAClC,IAAI,MAAM,KAAK,KAAK,EAAE;YACpB,OAAO,MAAM,CAAA;SACd;aAAM,IAAI,aAAa,CAAC,MAAM,CAAC,EAAE;YAChC,OAAO,IAAI,CAAA;SACZ;aAAM;YACL,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;YAClC,IAAI,MAAM,EAAE;gBACV,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;gBAC3B,OAAO,IAAI,CAAA;aACZ;iBAAM;gBACL,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;gBAC1B,OAAO,KAAK,CAAA;aACb;SACF;IACH,CAAC;IAED,GAAG,CAAC,GAAW;QACb,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QAClC,IAAI,MAAM,KAAK,KAAK,EAAE;YACpB,OAAO,SAAS,CAAA;SACjB;aAAM,IAAI,aAAa,CAAC,MAAM,CAAC,EAAE;YAChC,OAAO,MAAM,CAAA;SACd;aAAM;YACL,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;YAClC,IAAI,MAAM,EAAE;gBACV,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;gBAC3B,OAAO,MAAM,CAAA;aACd;iBAAM;gBACL,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;gBAC1B,OAAO,MAAM,CAAA;aACd;SACF;IACH,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,GAAW,EAAE,KAAa;QAClC,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;QAEhC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IACxB,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,GAAW;QACtB,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QAE5B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IACxB,CAAC;IAED,KAAK,CAAC,KAAK;QACT,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;QAExB,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;IACpB,CAAC;IAED,IAAI;QACF,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAA;IAC1B,CAAC;CACF"}
|
package/lib/disk-store.d.ts
CHANGED
package/lib/disk-store.js
CHANGED
|
@@ -1,47 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.DiskStore = void 0;
|
|
30
|
-
const Iter = __importStar(require("iterable-operator"));
|
|
31
|
-
const lmdb_1 = __importDefault(require("lmdb"));
|
|
32
|
-
const extra_filesystem_1 = require("extra-filesystem");
|
|
33
|
-
const prelude_1 = require("@blackglory/prelude");
|
|
34
|
-
class DiskStore {
|
|
1
|
+
import * as Iter from 'iterable-operator';
|
|
2
|
+
import * as LMDB from 'lmdb';
|
|
3
|
+
import { createTempNameSync, remove } from 'extra-filesystem';
|
|
4
|
+
import { isUndefined } from '@blackglory/prelude';
|
|
5
|
+
export class DiskStore {
|
|
35
6
|
constructor(dirname) {
|
|
36
|
-
if (
|
|
37
|
-
this._dirname =
|
|
7
|
+
if (isUndefined(dirname)) {
|
|
8
|
+
this._dirname = createTempNameSync();
|
|
38
9
|
this.isTempPathname = true;
|
|
39
10
|
}
|
|
40
11
|
else {
|
|
41
12
|
this._dirname = dirname;
|
|
42
13
|
this.isTempPathname = false;
|
|
43
14
|
}
|
|
44
|
-
this._db =
|
|
15
|
+
this._db = LMDB.open(this._dirname, {
|
|
45
16
|
encoding: 'binary',
|
|
46
17
|
compression: false
|
|
47
18
|
});
|
|
@@ -49,7 +20,7 @@ class DiskStore {
|
|
|
49
20
|
async close() {
|
|
50
21
|
await this._db.close();
|
|
51
22
|
if (this.isTempPathname) {
|
|
52
|
-
await
|
|
23
|
+
await remove(this._dirname);
|
|
53
24
|
}
|
|
54
25
|
}
|
|
55
26
|
has(key) {
|
|
@@ -71,5 +42,4 @@ class DiskStore {
|
|
|
71
42
|
return Iter.map(this._db.getKeys(), key => key);
|
|
72
43
|
}
|
|
73
44
|
}
|
|
74
|
-
exports.DiskStore = DiskStore;
|
|
75
45
|
//# sourceMappingURL=disk-store.js.map
|
package/lib/disk-store.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"disk-store.js","sourceRoot":"","sources":["../src/disk-store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"disk-store.js","sourceRoot":"","sources":["../src/disk-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,mBAAmB,CAAA;AACzC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAEjD,MAAM,OAAO,SAAS;IAKpB,YAAY,OAAgB;QAC1B,IAAI,WAAW,CAAC,OAAO,CAAC,EAAE;YACxB,IAAI,CAAC,QAAQ,GAAG,kBAAkB,EAAE,CAAA;YACpC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAA;SAC3B;aAAM;YACL,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;YACvB,IAAI,CAAC,cAAc,GAAG,KAAK,CAAA;SAC5B;QAED,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,IAAI,CAAiB,IAAI,CAAC,QAAQ,EAAE;YAGlD,QAAQ,EAAE,QAAQ;YAClB,WAAW,EAAE,KAAK;SACnB,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,KAAK;QACT,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAA;QAEtB,IAAI,IAAI,CAAC,cAAc,EAAE;YACvB,MAAM,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;SAC5B;IACH,CAAC;IAED,GAAG,CAAC,GAAW;QACb,OAAO,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;IAChC,CAAC;IAED,GAAG,CAAC,GAAW;QACb,OAAO,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;IAChC,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,GAAW,EAAE,KAAa;QAClC,MAAM,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IAChC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,GAAW;QACtB,MAAM,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IAC5B,CAAC;IAED,KAAK,CAAC,KAAK;QACT,MAAM,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,CAAA;IAC7B,CAAC;IAED,IAAI;QACF,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,GAAG,CAAC,EAAE,CAAC,GAAa,CAAC,CAAA;IAC3D,CAAC;CACF"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './disk-store';
|
|
2
|
-
export { DiskStoreWithCache, ICache } from './disk-store-with-cache';
|
|
3
|
-
export { DiskStoreView, IKeyConverter, IValueConverter } from './disk-store-view';
|
|
4
|
-
export * from './converters';
|
|
1
|
+
export * from './disk-store.js';
|
|
2
|
+
export { DiskStoreWithCache, ICache } from './disk-store-with-cache.js';
|
|
3
|
+
export { DiskStoreView, IKeyConverter, IValueConverter } from './disk-store-view.js';
|
|
4
|
+
export * from './converters/index.js';
|
package/lib/index.js
CHANGED
|
@@ -1,24 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.DiskStoreView = exports.DiskStoreWithCache = void 0;
|
|
18
|
-
__exportStar(require("./disk-store"), exports);
|
|
19
|
-
var disk_store_with_cache_1 = require("./disk-store-with-cache");
|
|
20
|
-
Object.defineProperty(exports, "DiskStoreWithCache", { enumerable: true, get: function () { return disk_store_with_cache_1.DiskStoreWithCache; } });
|
|
21
|
-
var disk_store_view_1 = require("./disk-store-view");
|
|
22
|
-
Object.defineProperty(exports, "DiskStoreView", { enumerable: true, get: function () { return disk_store_view_1.DiskStoreView; } });
|
|
23
|
-
__exportStar(require("./converters"), exports);
|
|
1
|
+
export * from './disk-store.js';
|
|
2
|
+
export { DiskStoreWithCache } from './disk-store-with-cache.js';
|
|
3
|
+
export { DiskStoreView } from './disk-store-view.js';
|
|
4
|
+
export * from './converters/index.js';
|
|
24
5
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,OAAO,EAAE,kBAAkB,EAAU,MAAM,4BAA4B,CAAA;AACvE,OAAO,EAAE,aAAa,EAAkC,MAAM,sBAAsB,CAAA;AACpF,cAAc,uBAAuB,CAAA"}
|
package/lib/types.d.ts
CHANGED
package/lib/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "extra-disk-store",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"files": [
|
|
7
|
-
"lib"
|
|
7
|
+
"lib",
|
|
8
|
+
"src"
|
|
8
9
|
],
|
|
10
|
+
"type": "module",
|
|
9
11
|
"main": "lib/index.js",
|
|
10
12
|
"types": "lib/index.d.ts",
|
|
11
13
|
"repository": "git@github.com:BlackGlory/extra-disk-store.git",
|
|
@@ -18,14 +20,12 @@
|
|
|
18
20
|
"scripts": {
|
|
19
21
|
"prepare": "ts-patch install -s",
|
|
20
22
|
"lint": "eslint --ext .js,.jsx,.ts,.tsx --quiet src __tests__",
|
|
21
|
-
"test": "jest --
|
|
22
|
-
"test:
|
|
23
|
-
"test:coverage": "jest --runInBand --coverage --config jest.config.js",
|
|
23
|
+
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --config jest.config.cjs",
|
|
24
|
+
"test:coverage": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --coverage --config jest.config.cjs",
|
|
24
25
|
"prepublishOnly": "run-s prepare clean build",
|
|
25
26
|
"clean": "rimraf lib",
|
|
26
|
-
"build": "
|
|
27
|
-
"
|
|
28
|
-
"bench": "ts-node --require tsconfig-paths/register benches/index.ts",
|
|
27
|
+
"build": "tsc --project tsconfig.build.json",
|
|
28
|
+
"bench": "ts-node --esm --require tsconfig-paths/register benches/index.ts",
|
|
29
29
|
"release": "standard-version"
|
|
30
30
|
},
|
|
31
31
|
"husky": {
|
|
@@ -35,36 +35,39 @@
|
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@blackglory/
|
|
39
|
-
"@
|
|
40
|
-
"@commitlint/
|
|
41
|
-
"@
|
|
42
|
-
"@types/
|
|
43
|
-
"@
|
|
44
|
-
"@typescript-eslint/
|
|
45
|
-
"eslint": "^
|
|
38
|
+
"@blackglory/jest-resolver": "^0.3.0",
|
|
39
|
+
"@blackglory/structures": "^0.13.1",
|
|
40
|
+
"@commitlint/cli": "^17.4.4",
|
|
41
|
+
"@commitlint/config-conventional": "^17.4.4",
|
|
42
|
+
"@types/jest": "^29.4.0",
|
|
43
|
+
"@types/node": "16",
|
|
44
|
+
"@typescript-eslint/eslint-plugin": "^5.54.1",
|
|
45
|
+
"@typescript-eslint/parser": "^5.54.1",
|
|
46
|
+
"cross-env": "^7.0.3",
|
|
47
|
+
"eslint": "^8.36.0",
|
|
46
48
|
"husky": "^4.3.0",
|
|
47
|
-
"jest": "^29.
|
|
49
|
+
"jest": "^29.5.0",
|
|
50
|
+
"jest-resolve": "^29.5.0",
|
|
48
51
|
"npm-run-all": "^4.1.5",
|
|
49
|
-
"pretty-bytes": "
|
|
52
|
+
"pretty-bytes": "6.1.0",
|
|
50
53
|
"rimraf": "^3.0.2",
|
|
51
54
|
"standard-version": "^9.5.0",
|
|
52
|
-
"ts-jest": "^29.0.
|
|
55
|
+
"ts-jest": "^29.0.5",
|
|
53
56
|
"ts-node": "^10.9.1",
|
|
54
57
|
"ts-patch": "^2.1.0",
|
|
55
|
-
"tsconfig-paths": "^4.1.
|
|
58
|
+
"tsconfig-paths": "^4.1.2",
|
|
56
59
|
"typescript": "4.8",
|
|
57
|
-
"typescript-transform-paths": "^3.4.
|
|
60
|
+
"typescript-transform-paths": "^3.4.6"
|
|
58
61
|
},
|
|
59
62
|
"dependencies": {
|
|
60
|
-
"@blackglory/prelude": "^0.
|
|
61
|
-
"@mongodb-js/zstd": "^1.
|
|
63
|
+
"@blackglory/prelude": "^0.3.1",
|
|
64
|
+
"@mongodb-js/zstd": "^1.1.0",
|
|
62
65
|
"extra-benchmark": "^0.2.2",
|
|
63
|
-
"extra-filesystem": "^0.4.
|
|
64
|
-
"extra-promise": "^
|
|
65
|
-
"extra-utils": "^
|
|
66
|
-
"iterable-operator": "^
|
|
67
|
-
"lmdb": "^2.7.
|
|
66
|
+
"extra-filesystem": "^0.4.10",
|
|
67
|
+
"extra-promise": "^6.0.3",
|
|
68
|
+
"extra-utils": "^5.1.0",
|
|
69
|
+
"iterable-operator": "^4.0.3",
|
|
70
|
+
"lmdb": "^2.7.10",
|
|
68
71
|
"lz4-wasm-nodejs": "^0.9.2"
|
|
69
72
|
}
|
|
70
73
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IKeyConverter } from '@src/types.js'
|
|
2
|
+
|
|
3
|
+
export class IndexKeyConverter implements IKeyConverter<number> {
|
|
4
|
+
constructor(private radix: number = 10) {}
|
|
5
|
+
|
|
6
|
+
toString(value: number): string {
|
|
7
|
+
return value.toString(this.radix)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
fromString(value: string): number {
|
|
11
|
+
return Number.parseInt(value, this.radix)
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './json-key-converter.js'
|
|
2
|
+
export * from './json-value-converter.js'
|
|
3
|
+
|
|
4
|
+
export * from './passthrough-key-converter.js'
|
|
5
|
+
export * from './passthrough-value-converter.js'
|
|
6
|
+
|
|
7
|
+
export * from './index-key-converter.js'
|
|
8
|
+
export * from './prefix-key-converter.js'
|
|
9
|
+
|
|
10
|
+
export * from './lz4-value-converter.js'
|
|
11
|
+
export * from './zstandard-value-converter.js'
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IValueConverter } from '@src/types.js'
|
|
2
|
+
|
|
3
|
+
export class JSONValueConverter<T> implements IValueConverter<T> {
|
|
4
|
+
constructor(private encoding: BufferEncoding = 'utf-8') {}
|
|
5
|
+
|
|
6
|
+
fromBuffer(buffer: Buffer): T {
|
|
7
|
+
return JSON.parse(buffer.toString(this.encoding))
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
toBuffer(value: T): Buffer {
|
|
11
|
+
return Buffer.from(JSON.stringify(value), this.encoding)
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as lz4 from 'lz4-wasm-nodejs'
|
|
2
|
+
import { IValueConverter } from '@src/types.js'
|
|
3
|
+
|
|
4
|
+
export class LZ4ValueConverter<T> implements IValueConverter<T> {
|
|
5
|
+
constructor(
|
|
6
|
+
private valueConverter: IValueConverter<T>
|
|
7
|
+
) {}
|
|
8
|
+
|
|
9
|
+
async toBuffer(value: T): Promise<Buffer> {
|
|
10
|
+
const buffer = await this.valueConverter.toBuffer(value)
|
|
11
|
+
return Buffer.from(lz4.compress(buffer))
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async fromBuffer(value: Buffer): Promise<T> {
|
|
15
|
+
const buffer = Buffer.from(lz4.decompress(value))
|
|
16
|
+
return await this.valueConverter.fromBuffer(buffer)
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { IKeyConverter } from '@src/types.js'
|
|
2
|
+
|
|
3
|
+
export class PrefixKeyConverter<T> implements IKeyConverter<T> {
|
|
4
|
+
constructor(
|
|
5
|
+
private keyConverter: IKeyConverter<T>
|
|
6
|
+
, private prefix: string
|
|
7
|
+
) {}
|
|
8
|
+
|
|
9
|
+
async toString(value: T): Promise<string> {
|
|
10
|
+
const key = await this.keyConverter.toString(value)
|
|
11
|
+
return this.prefix + key
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async fromString(value: string): Promise<T | undefined> {
|
|
15
|
+
if (value.startsWith(this.prefix)) {
|
|
16
|
+
const key = await this.keyConverter.fromString(value.slice(this.prefix.length))
|
|
17
|
+
return key
|
|
18
|
+
} else {
|
|
19
|
+
return undefined
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as zstd from '@mongodb-js/zstd'
|
|
2
|
+
import { IValueConverter } from '@src/types.js'
|
|
3
|
+
|
|
4
|
+
export class ZstandardValueConverter<T> implements IValueConverter<T> {
|
|
5
|
+
constructor(
|
|
6
|
+
private valueConverter: IValueConverter<T>
|
|
7
|
+
, private level: number
|
|
8
|
+
) {}
|
|
9
|
+
|
|
10
|
+
async toBuffer(value: T): Promise<Buffer> {
|
|
11
|
+
const buffer = await this.valueConverter.toBuffer(value)
|
|
12
|
+
return Buffer.from(await zstd.compress(buffer, this.level))
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async fromBuffer(value: Buffer): Promise<T> {
|
|
16
|
+
const buffer = Buffer.from(await zstd.decompress(value))
|
|
17
|
+
return await this.valueConverter.fromBuffer(buffer)
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { DiskStore } from '@src/disk-store.js'
|
|
2
|
+
import { DiskStoreWithCache } from '@src/disk-store-with-cache.js'
|
|
3
|
+
import { pipe } from 'extra-utils'
|
|
4
|
+
import { mapAsync, filterAsync } from 'iterable-operator'
|
|
5
|
+
import { Awaitable, isntUndefined } from '@blackglory/prelude'
|
|
6
|
+
|
|
7
|
+
export interface IKeyConverter<T> {
|
|
8
|
+
toString: (value: T) => Awaitable<string>
|
|
9
|
+
fromString: (value: string) => Awaitable<T | undefined>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface IValueConverter<T> {
|
|
13
|
+
toBuffer: (value: T) => Awaitable<Buffer>
|
|
14
|
+
fromBuffer: (value: Buffer) => Awaitable<T>
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export class DiskStoreView<K, V> {
|
|
18
|
+
constructor(
|
|
19
|
+
private store: DiskStore | DiskStoreWithCache
|
|
20
|
+
, private keyConverter: IKeyConverter<K>
|
|
21
|
+
, private valueConverter: IValueConverter<V>
|
|
22
|
+
) {}
|
|
23
|
+
|
|
24
|
+
async has(key: K): Promise<boolean> {
|
|
25
|
+
return this.store.has(await this.keyConverter.toString(key))
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async get(key: K): Promise<V | undefined> {
|
|
29
|
+
const buffer = this.store.get(await this.keyConverter.toString(key))
|
|
30
|
+
|
|
31
|
+
if (buffer) {
|
|
32
|
+
return this.valueConverter.fromBuffer(buffer)
|
|
33
|
+
} else {
|
|
34
|
+
return undefined
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async set(key: K, value: V): Promise<void> {
|
|
39
|
+
await this.store.set(
|
|
40
|
+
...await Promise.all([
|
|
41
|
+
await this.keyConverter.toString(key)
|
|
42
|
+
, await this.valueConverter.toBuffer(value)
|
|
43
|
+
])
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async delete(key: K): Promise<void> {
|
|
48
|
+
await this.store.delete(await this.keyConverter.toString(key))
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async clear(): Promise<void> {
|
|
52
|
+
await this.store.clear()
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
keys(): AsyncIterableIterator<K> {
|
|
56
|
+
return pipe(
|
|
57
|
+
this.store.keys()
|
|
58
|
+
, iter => mapAsync(iter, async key => await this.keyConverter.fromString(key))
|
|
59
|
+
, iter => filterAsync(iter, isntUndefined)
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { isntUndefined } from '@blackglory/prelude'
|
|
2
|
+
import { DiskStore } from './disk-store.js'
|
|
3
|
+
|
|
4
|
+
export interface ICache {
|
|
5
|
+
set(key: string, value: Buffer | false): void
|
|
6
|
+
get(key: string): Buffer | false | undefined
|
|
7
|
+
delete(key: string): void
|
|
8
|
+
clear(): void
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export class DiskStoreWithCache {
|
|
12
|
+
constructor(
|
|
13
|
+
private store: DiskStore
|
|
14
|
+
, private cache: ICache
|
|
15
|
+
) {}
|
|
16
|
+
|
|
17
|
+
async close(): Promise<void> {
|
|
18
|
+
await this.store.close()
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
has(key: string): boolean {
|
|
22
|
+
const result = this.cache.get(key)
|
|
23
|
+
if (result === false) {
|
|
24
|
+
return result
|
|
25
|
+
} else if (isntUndefined(result)) {
|
|
26
|
+
return true
|
|
27
|
+
} else {
|
|
28
|
+
const result = this.store.get(key)
|
|
29
|
+
if (result) {
|
|
30
|
+
this.cache.set(key, result)
|
|
31
|
+
return true
|
|
32
|
+
} else {
|
|
33
|
+
this.cache.set(key, false)
|
|
34
|
+
return false
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
get(key: string): Buffer | undefined {
|
|
40
|
+
const result = this.cache.get(key)
|
|
41
|
+
if (result === false) {
|
|
42
|
+
return undefined
|
|
43
|
+
} else if (isntUndefined(result)) {
|
|
44
|
+
return result
|
|
45
|
+
} else {
|
|
46
|
+
const result = this.store.get(key)
|
|
47
|
+
if (result) {
|
|
48
|
+
this.cache.set(key, result)
|
|
49
|
+
return result
|
|
50
|
+
} else {
|
|
51
|
+
this.cache.set(key, false)
|
|
52
|
+
return result
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async set(key: string, value: Buffer): Promise<void> {
|
|
58
|
+
await this.store.set(key, value)
|
|
59
|
+
|
|
60
|
+
this.cache.delete(key)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async delete(key: string): Promise<void> {
|
|
64
|
+
await this.store.delete(key)
|
|
65
|
+
|
|
66
|
+
this.cache.delete(key)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
async clear(): Promise<void> {
|
|
70
|
+
await this.store.clear()
|
|
71
|
+
|
|
72
|
+
this.cache.clear()
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
keys(): IterableIterator<string> {
|
|
76
|
+
return this.store.keys()
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as Iter from 'iterable-operator'
|
|
2
|
+
import * as LMDB from 'lmdb'
|
|
3
|
+
import { createTempNameSync, remove } from 'extra-filesystem'
|
|
4
|
+
import { isUndefined } from '@blackglory/prelude'
|
|
5
|
+
|
|
6
|
+
export class DiskStore {
|
|
7
|
+
public _db: LMDB.RootDatabase
|
|
8
|
+
public _dirname: string
|
|
9
|
+
private isTempPathname: boolean
|
|
10
|
+
|
|
11
|
+
constructor(dirname?: string) {
|
|
12
|
+
if (isUndefined(dirname)) {
|
|
13
|
+
this._dirname = createTempNameSync()
|
|
14
|
+
this.isTempPathname = true
|
|
15
|
+
} else {
|
|
16
|
+
this._dirname = dirname
|
|
17
|
+
this.isTempPathname = false
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
this._db = LMDB.open<Buffer, string>(this._dirname, {
|
|
21
|
+
// 采用其他编码方式可能遇到错误.
|
|
22
|
+
// 尤其是采用与lmdb-js同作者的msgpackr一定会出现错误, 因为它是一个有问题的实现.
|
|
23
|
+
encoding: 'binary'
|
|
24
|
+
, compression: false
|
|
25
|
+
})
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async close(): Promise<void> {
|
|
29
|
+
await this._db.close()
|
|
30
|
+
|
|
31
|
+
if (this.isTempPathname) {
|
|
32
|
+
await remove(this._dirname)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
has(key: string): boolean {
|
|
37
|
+
return this._db.doesExist(key)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
get(key: string): Buffer | undefined {
|
|
41
|
+
return this._db.getBinary(key)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async set(key: string, value: Buffer): Promise<void> {
|
|
45
|
+
await this._db.put(key, value)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async delete(key: string): Promise<void> {
|
|
49
|
+
await this._db.remove(key)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async clear(): Promise<void> {
|
|
53
|
+
await this._db.clearAsync()
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
keys(): IterableIterator<string> {
|
|
57
|
+
return Iter.map(this._db.getKeys(), key => key as string)
|
|
58
|
+
}
|
|
59
|
+
}
|
package/src/index.ts
ADDED
package/src/types.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Awaitable } from '@blackglory/prelude'
|
|
2
|
+
|
|
3
|
+
export interface ICache {
|
|
4
|
+
set(key: string, value: Buffer | boolean | undefined): void
|
|
5
|
+
get(key: string): Buffer | boolean | undefined
|
|
6
|
+
delete(key: string): void
|
|
7
|
+
clear(): void
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface IKeyConverter<T> {
|
|
11
|
+
toString: (value: T) => Awaitable<string>
|
|
12
|
+
fromString: (value: string) => Awaitable<T | undefined>
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface IValueConverter<T> {
|
|
16
|
+
toBuffer: (value: T) => Awaitable<Buffer>
|
|
17
|
+
fromBuffer: (value: Buffer) => Awaitable<T>
|
|
18
|
+
}
|