@wxn0brp/db-storage-bin 0.0.4 → 0.0.5
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/CHANGELOG.md +7 -0
- package/dist/bin/data.js +2 -1
- package/dist/bin/head.js +1 -1
- package/dist/bin/index.d.ts +3 -0
- package/dist/bin/index.js +3 -0
- package/package.json +1 -1
- package/src/bin/data.ts +2 -1
- package/src/bin/head.ts +1 -1
- package/src/bin/index.ts +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.0.5](https://github.com/wxn0brp/ValtheraDB-storage-bin/compare/v0.0.4...v0.0.5) (2025-09-04)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* crc and new crc mode ([cc79715](https://github.com/wxn0brp/ValtheraDB-storage-bin/commit/cc7971591dbcd39fd5b9371644d2c3e9997f0dbc))
|
|
11
|
+
|
|
5
12
|
### [0.0.4](https://github.com/wxn0brp/ValtheraDB-storage-bin/compare/v0.0.3...v0.0.4) (2025-09-04)
|
|
6
13
|
|
|
7
14
|
|
package/dist/bin/data.js
CHANGED
|
@@ -71,7 +71,8 @@ export async function writeLogic(cmp, collection, data) {
|
|
|
71
71
|
await _log(2, "Capacity exceeded");
|
|
72
72
|
}
|
|
73
73
|
else {
|
|
74
|
-
|
|
74
|
+
const crc = cmp.options.crc;
|
|
75
|
+
if (crc === 3 || crc === 4) {
|
|
75
76
|
const { computedCrc } = await getFileCrc(fd);
|
|
76
77
|
const crcBuf = Buffer.alloc(16);
|
|
77
78
|
crcBuf.writeUInt32LE(computedCrc);
|
package/dist/bin/head.js
CHANGED
package/dist/bin/index.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ export interface Options {
|
|
|
11
11
|
* 0 - crc off
|
|
12
12
|
* 1 - warn if error
|
|
13
13
|
* 2 - throw if error
|
|
14
|
+
* 3 - 1 & save always on edit
|
|
15
|
+
* 4 - 2 & save always on edit
|
|
14
16
|
*/
|
|
15
17
|
crc: number;
|
|
16
18
|
overwriteRemovedCollection: boolean;
|
|
@@ -34,6 +36,7 @@ export declare class BinManager {
|
|
|
34
36
|
constructor(path: string, options?: Partial<Options>);
|
|
35
37
|
open(): Promise<void>;
|
|
36
38
|
close(): Promise<void>;
|
|
39
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
37
40
|
write<T = object[]>(collection: string, data: T): Promise<void>;
|
|
38
41
|
read(collection: string): Promise<any>;
|
|
39
42
|
optimize(): Promise<void>;
|
package/dist/bin/index.js
CHANGED
package/package.json
CHANGED
package/src/bin/data.ts
CHANGED
|
@@ -80,7 +80,8 @@ export async function writeLogic(cmp: BinManager, collection: string, data: any)
|
|
|
80
80
|
await saveHeaderAndPayload(cmp);
|
|
81
81
|
await _log(2, "Capacity exceeded");
|
|
82
82
|
} else {
|
|
83
|
-
|
|
83
|
+
const crc = cmp.options.crc;
|
|
84
|
+
if (crc === 3 || crc === 4) {
|
|
84
85
|
const { computedCrc } = await getFileCrc(fd);
|
|
85
86
|
const crcBuf = Buffer.alloc(16);
|
|
86
87
|
crcBuf.writeUInt32LE(computedCrc);
|
package/src/bin/head.ts
CHANGED
package/src/bin/index.ts
CHANGED
|
@@ -29,6 +29,8 @@ export interface Options {
|
|
|
29
29
|
* 0 - crc off
|
|
30
30
|
* 1 - warn if error
|
|
31
31
|
* 2 - throw if error
|
|
32
|
+
* 3 - 1 & save always on edit
|
|
33
|
+
* 4 - 2 & save always on edit
|
|
32
34
|
*/
|
|
33
35
|
crc: number;
|
|
34
36
|
overwriteRemovedCollection: boolean;
|
|
@@ -87,6 +89,10 @@ export class BinManager {
|
|
|
87
89
|
}
|
|
88
90
|
}
|
|
89
91
|
|
|
92
|
+
[Symbol.asyncDispose]() {
|
|
93
|
+
return this.close();
|
|
94
|
+
}
|
|
95
|
+
|
|
90
96
|
async write<T = object[]>(collection: string, data: T) {
|
|
91
97
|
if (!this.fd) throw new Error("File not open");
|
|
92
98
|
await writeLogic(this, collection, data);
|