inibase 1.0.0-rc.4 → 1.0.0-rc.40

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 CHANGED
@@ -2,26 +2,30 @@
2
2
 
3
3
  # Inibase :pencil:
4
4
 
5
- [![npmjs](https://img.shields.io/npm/dm/inibase.svg?style=flat)](https://www.npmjs.org/package/inibase) [![Node.js Version](https://img.shields.io/badge/node-18.11.0-blue)](https://nodejs.org/) [![License](https://img.shields.io/github/license/inicontent/inibase.svg?style=flat&colorA=18181B&colorB=28CF8D)](./LICENSE) [![Activity](https://img.shields.io/github/commit-activity/m/inicontent/inibase)](https://github.com/inicontent/inibase/pulse) [![GitHub stars](https://img.shields.io/github/stars/inicontent/inibase?style=social)](https://github.com/inicontent/inibase)
5
+ [![npmjs](https://img.shields.io/npm/dm/inibase.svg?style=flat)](https://www.npmjs.org/package/inibase) [![License](https://img.shields.io/github/license/inicontent/inibase.svg?style=flat&colorA=18181B&colorB=28CF8D)](./LICENSE) [![Activity](https://img.shields.io/github/commit-activity/m/inicontent/inibase)](https://github.com/inicontent/inibase/pulse) [![GitHub stars](https://img.shields.io/github/stars/inicontent/inibase?style=social)](https://github.com/inicontent/inibase)
6
6
 
7
- > File-based relational database, simple to use and can handle large data :fire:
7
+ > A file-based & memory-efficient, serverless, ACID compliant, relational database management system :fire:
8
8
 
9
9
  ## Features
10
10
 
11
- - **Lightweight** 🪶 (~60kb)
12
- - **Minimalist** :white_circle:
11
+ - **Lightweight** 🪶
12
+ - **Minimalist** :white_circle: (but powerful)
13
13
  - **TypeScript** :large_blue_diamond:
14
- - **Super-Fast** :turtle:
15
- - **Suitable for large data** :page_with_curl:
16
- - **Safe** :lock:
17
- - **Easy to use** :hourglass:
14
+ - **Super-Fast** :zap: (built-in caching system)
15
+ - **Built-in form-validation** included :sunglasses:
16
+ - **Suitable for large data** :page_with_curl: (tested with 200K row)
17
+ - **Support Compression** :eight_spoked_asterisk: (using built-in nodejs zlib)
18
+ - **Support Table Joins** :link:
19
+ - **Low memory-usage** :chart_with_downwards_trend: (3-5mb)
20
+ - **Safe** :lock: (no sql or javascript injections)
21
+ - **Easy to use** :bread:
18
22
  - **...** and much more :rocket:
19
23
 
20
24
  ## Usage
21
25
 
22
26
  ```js
23
27
  import Inibase from "inibase";
24
- const db = new Inibase("/database_name");
28
+ const db = new Inibase("database_name");
25
29
 
26
30
  // Get all items from "user" table
27
31
  const users = await db.get("user");
@@ -30,36 +34,87 @@ const users = await db.get("user");
30
34
  const users = await db.get("user", undefined, { page: 2, per_page: 15 });
31
35
 
32
36
  // Get only required columns to improve speed
33
- const users = await InibaseDB.get("user", undefined, {
34
- columns: ["username", "address.street", "hobbies.*.name"],
37
+ const users = await db.get("user", undefined, {
38
+ columns: ["username", "address.street", "hobbies.name"],
35
39
  });
36
40
 
37
- // Get items from "user" table where "favoriteFoods" does not includes "Pizza"
38
- const users = await InibaseDB.get("user", { favoriteFoods: "![]Pizza" });
41
+ // Get items from "user" table where "favoriteFoods" does not includes "Pizza" or "Burger"
42
+ const users = await db.get("user", { favoriteFoods: "![]Pizza,Burger" });
39
43
  ```
40
44
 
41
45
  If you like Inibase, please sponsor: [GitHub Sponsors](https://github.com/sponsors/inicontent) || [Paypal](https://paypal.me/KarimAmahtil).
42
46
 
43
- ## Sponsors
44
-
45
- <br>
46
- <br>
47
-
48
- Become a sponsor and have your company logo here 👉 [GitHub Sponsors](https://github.com/sponsors/inicontent) || [paypal](https://paypal.me/KarimAmahtil).
49
-
50
47
  ## Install
51
48
 
52
49
  ```js
53
- // npm
54
- npm install inibase
55
-
56
- // pnpm
57
- pnpm add inibase
50
+ <npm|pnpm|yarn> install inibase
58
51
  ```
59
52
 
60
53
  ## How it works?
61
54
 
62
- To semplify the idea, each database has tables, each table has columns, each column will be stored in a seperated file. When POSTing new data, it will be appended to each columns file as new line. When GETing data, the file will be readed line-by-line so it can handle large data (without consuming a lot of resources)
55
+ To simplify the idea, each database has tables, each table has columns, each column will be stored in a seperated file. When **POST**ing new data, it will be appended to the _head_ of each file as new line. When **GET**ing data, the file will be readed line-by-line so it can handle large data (without consuming a lot of resources), when **PUT**ing(updating) in a specific column, only one file will be opened and updated
56
+
57
+ ## Benchmark
58
+
59
+ ### Bulk
60
+
61
+ | | 10 | 100 | 1000 |
62
+ |--------|-----------------|-----------------|-----------------|
63
+ | POST | 11 ms (0.65 mb) | 19 ms (1.00 mb) | 85 ms (4.58 mb) |
64
+ | GET | 14 ms (2.77 mb) | 12 ms (3.16 mb) | 34 ms (1.38 mb) |
65
+ | PUT | 6 ms (1.11 mb) | 5 ms (1.37 mb) | 10 ms (1.12 mb) |
66
+ | DELETE | 17 ms (1.68 mb) | 14 ms (5.45 mb) | 25 ms (5.94 mb) |
67
+
68
+ ### Single
69
+
70
+ | | 10 | 100 | 1000 |
71
+ |--------|-------------------|--------------------|--------------------|
72
+ | POST | 43 ms (4.70 mb) | 387 ms (6.36 mb) | 5341 ms (24.73 mb) |
73
+ | GET | 99 ms (12.51 mb) | 846 ms (30.68 mb) | 7103 ms (30.86 mb) |
74
+ | PUT | 33 ms (10.29 mb) | 312 ms (11.06 mb) | 3539 ms (14.87 mb) |
75
+ | DELETE | 134 ms (13.50 mb) | 1224 ms (16.57 mb) | 7339 ms (11.46 mb) |
76
+
77
+ Ps: Testing by default with `user` table, with username, email, password fields _so results include password encryption process_
78
+
79
+
80
+ ## Roadmap
81
+
82
+ - [x] Actions:
83
+ - [x] GET:
84
+ - [x] Pagination
85
+ - [x] Criteria
86
+ - [x] Columns
87
+ - [ ] Order By
88
+ - [x] POST
89
+ - [x] PUT
90
+ - [x] DELETE
91
+ - [x] SUM
92
+ - [x] MAX
93
+ - [x] MIN
94
+ - [ ] Schema supported types:
95
+ - [x] String
96
+ - [x] Number
97
+ - [x] Boolean
98
+ - [x] Date
99
+ - [x] Email
100
+ - [x] Url
101
+ - [x] Table
102
+ - [x] Object
103
+ - [x] Array
104
+ - [x] Password
105
+ - [x] IP
106
+ - [x] HTML
107
+ - [x] Id
108
+ - [x] JSON
109
+ - [ ] TO-DO:
110
+ - [x] Improve caching
111
+ - [x] Commenting the code
112
+ - [ ] Features:
113
+ - [ ] Encryption
114
+ - [x] Data Compression
115
+ - [x] Caching System
116
+ - [ ] Suggest [new feature +](https://github.com/inicontent/inibase/discussions/new?category=ideas)
117
+
63
118
 
64
119
  ## Examples
65
120
 
@@ -342,6 +397,11 @@ const users = await db.get("user", { favoriteFoods: "[]Pizza" });
342
397
  // },
343
398
  // ...
344
399
  // ]
400
+
401
+ // Get all "user" columns except "username" & "address.street"
402
+ const users = await db.get("user", undefined, {
403
+ columns: ["!username", "!address.street"],
404
+ });
345
405
  ```
346
406
 
347
407
  </details>
@@ -384,87 +444,95 @@ await db.put("user", { isActive: false });
384
444
 
385
445
  </details>
386
446
 
387
- ## Typescript
447
+ <details>
448
+ <summary>SUM</summary>
449
+
450
+ ```js
451
+ import Inibase from "inibase";
452
+ const db = new Inibase("/database_name");
453
+
454
+ // get the sum of column "age" in "user" table
455
+ await db.sum("user", "age");
456
+
457
+ // get the sum of column "age" by criteria (where "isActive" is equal to "false") in "user" table
458
+ await db.sum("user", ["age", ...], { isActive: false });
459
+ ```
460
+
461
+ </details>
388
462
 
389
463
  <details>
390
- <summary>Schema</summary>
464
+ <summary>MAX</summary>
391
465
 
392
466
  ```js
393
- type Schema = Field[];
394
- type Field = {
395
- id?: string | number | null | undefined,
396
- key: string,
397
- required?: boolean,
398
- } & (
399
- | {
400
- type: Exclude<FieldType, "array" | "object">,
401
- required?: boolean,
402
- }
403
- | {
404
- type: "array",
405
- children: FieldType | FieldType[] | Schema,
406
- }
407
- | {
408
- type: "object",
409
- children: Schema,
410
- }
411
- );
412
- type FieldType =
413
- | "string"
414
- | "number"
415
- | "boolean"
416
- | "date"
417
- | "email"
418
- | "url"
419
- | "table"
420
- | "object"
421
- | "array"
422
- | "password";
467
+ import Inibase from "inibase";
468
+ const db = new Inibase("/database_name");
469
+
470
+ // get the biggest number of column "age" in "user" table
471
+ await db.max("user", "age");
472
+
473
+ // get the biggest number of column "age" by criteria (where "isActive" is equal to "false") in "user" table
474
+ await db.max("user", ["age", ...], { isActive: false });
423
475
  ```
424
476
 
425
477
  </details>
426
478
 
427
479
  <details>
428
- <summary>Data</summary>
480
+ <summary>MIN</summary>
429
481
 
430
482
  ```js
431
- type Data = {
432
- id?: number | string,
433
- [key: string]: any,
434
- created_at?: Date,
435
- updated_at?: Date,
436
- };
483
+ import Inibase from "inibase";
484
+ const db = new Inibase("/database_name");
485
+
486
+ // get the smallest number of column "age" in "user" table
487
+ await db.min("user", "age");
488
+
489
+ // get the smallest number of column "age" by criteria (where "isActive" is equal to "false") in "user" table
490
+ await db.min("user", ["age", ...], { isActive: false });
437
491
  ```
438
492
 
439
493
  </details>
440
494
 
441
- ## Roadmap
495
+ <details>
496
+ <summary>createWorker</summary>
442
497
 
443
- - [x] Actions:
444
- - [x] GET:
445
- - [x] Pagination
446
- - [x] Criteria
447
- - [x] Columns
448
- - [ ] Order
449
- - [x] POST
450
- - [x] PUT
451
- - [x] DELETE
452
- - [ ] Schema supported types:
453
- - [x] String
454
- - [x] Number
455
- - [x] Boolean
456
- - [x] Date
457
- - [x] Email
458
- - [x] Url
459
- - [x] Table
460
- - [x] Object
461
- - [x] Array
462
- - [x] Password
463
- - [ ] IP
464
- - [ ] Features:
465
- - [ ] Encryption
466
- - [ ] Compress data
467
- - [ ] Suggest [new feature +](https://github.com/inicontent/inibase/discussions/new?category=ideas)
498
+ ```js
499
+ import Inibase from "inibase";
500
+ const db = new Inibase("/database_name");
501
+
502
+ // POST 10,000 USER
503
+ await Promise.all(
504
+ [...Array(10)]
505
+ .map((x, i) => i)
506
+ .map(
507
+ (_index) =>
508
+ db.createWorker("post", [
509
+ "user",
510
+ [...Array(1000)].map((_, i) => ({
511
+ username: `username_${i + 1}`,
512
+ email: `email_${i + 1}@test.com`,
513
+ password: `password_${i + 1}`,
514
+ })),
515
+ ])
516
+ )
517
+ )
518
+ ```
519
+
520
+ </details>
521
+
522
+ ## Config (.env)
523
+
524
+ The `.env` file supports the following parameters (make sure to run commands with flag --env-file=.env)
525
+
526
+ ```ini
527
+ # Auto generated secret key, will be using for encrypting the IDs
528
+ INIBASE_SECRET=
529
+
530
+ INIBASE_COMPRESSION=true
531
+ INIBASE_CACHE=true
532
+
533
+ # Prepend new items to the beginning of file
534
+ INIBASE_REVERSE=true
535
+ ```
468
536
 
469
537
  ## License
470
538
 
@@ -0,0 +1,5 @@
1
+ export default class Config {
2
+ static isCompressionEnabled: boolean;
3
+ static isCacheEnabled: boolean;
4
+ static isReverseEnabled: boolean;
5
+ }
package/dist/config.js ADDED
@@ -0,0 +1,5 @@
1
+ export default class Config {
2
+ static isCompressionEnabled = process.env.INIBASE_COMPRESSION === "true";
3
+ static isCacheEnabled = process.env.INIBASE_CACHE === "true";
4
+ static isReverseEnabled = process.env.INIBASE_REVERSE === "true";
5
+ }
package/dist/file.d.ts ADDED
@@ -0,0 +1,176 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import { ComparisonOperator, FieldType } from "./index.js";
3
+ export declare const lock: (folderPath: string, prefix?: string) => Promise<void>;
4
+ export declare const unlock: (folderPath: string, prefix?: string) => Promise<void>;
5
+ export declare const write: (filePath: string, data: any, disableCompression?: boolean) => Promise<void>;
6
+ export declare const read: (filePath: string, disableCompression?: boolean) => Promise<string>;
7
+ /**
8
+ * Checks if a file or directory exists at the specified path.
9
+ *
10
+ * @param path - The path to the file or directory.
11
+ * @returns A Promise that resolves to true if the file/directory exists, false otherwise.
12
+ */
13
+ export declare const isExists: (path: string) => Promise<boolean>;
14
+ /**
15
+ * Encodes the input using 'secureString' and 'joinMultidimensionalArray' functions.
16
+ * If the input is an array, it is first secured and then joined into a string.
17
+ * If the input is a single value, it is directly secured.
18
+ *
19
+ * @param input - A value or array of values (string, number, boolean, null).
20
+ * @returns The secured and/or joined string.
21
+ */
22
+ export declare const encode: (input: string | number | boolean | null | (string | number | boolean | null)[]) => string | number | boolean | null;
23
+ /**
24
+ * Decodes the input based on the specified field type(s) and an optional secret key.
25
+ * Handles different formats of input, including strings, numbers, and their array representations.
26
+ *
27
+ * @param input - The input to be decoded, can be a string, number, or null.
28
+ * @param fieldType - Optional type of the field to guide decoding (e.g., 'number', 'boolean').
29
+ * @param fieldChildrenType - Optional type for child elements in array inputs.
30
+ * @param secretKey - Optional secret key for decoding, can be a string or Buffer.
31
+ * @returns Decoded value as a string, number, boolean, or array of these, or null if no fieldType or input is null/empty.
32
+ */
33
+ export declare const decode: (input: string | null | number, fieldType?: FieldType | FieldType[], fieldChildrenType?: FieldType | FieldType[], secretKey?: string | Buffer) => string | number | boolean | null | (string | number | null | boolean)[];
34
+ /**
35
+ * Asynchronously reads and decodes data from a file at specified line numbers.
36
+ * Decodes each line based on specified field types and an optional secret key.
37
+ *
38
+ * @param filePath - Path of the file to be read.
39
+ * @param lineNumbers - Optional line number(s) to read from the file. If -1, reads the last line.
40
+ * @param fieldType - Optional type of the field to guide decoding (e.g., 'number', 'boolean').
41
+ * @param fieldChildrenType - Optional type for child elements in array inputs.
42
+ * @param secretKey - Optional secret key for decoding, can be a string or Buffer.
43
+ * @returns Promise resolving to a tuple:
44
+ * 1. Record of line numbers and their decoded content or null if no lines are read.
45
+ * 2. Total count of lines processed.
46
+ */
47
+ export declare function get(filePath: string, lineNumbers?: number | number[], fieldType?: FieldType | FieldType[], fieldChildrenType?: FieldType | FieldType[], secretKey?: string | Buffer, readWholeFile?: false): Promise<Record<number, string | number | boolean | null | (string | number | boolean | (string | number | boolean)[] | null)[]> | null>;
48
+ export declare function get(filePath: string, lineNumbers: undefined | number | number[], fieldType: undefined | FieldType | FieldType[], fieldChildrenType: undefined | FieldType | FieldType[], secretKey: undefined | string | Buffer, readWholeFile: true): Promise<[
49
+ Record<number, string | number | boolean | null | (string | number | boolean | (string | number | boolean)[] | null)[]> | null,
50
+ number
51
+ ]>;
52
+ /**
53
+ * Asynchronously replaces specific lines in a file based on the provided replacements map or string.
54
+ *
55
+ * @param filePath - Path of the file to modify.
56
+ * @param replacements - Map of line numbers to replacement values, or a single replacement value for all lines.
57
+ * Can be a string, number, boolean, null, array of these types, or a Record/Map of line numbers to these types.
58
+ * @returns Promise<string[]>
59
+ *
60
+ * Note: If the file doesn't exist and replacements is an object, it creates a new file with the specified replacements.
61
+ */
62
+ export declare const replace: (filePath: string, replacements: string | number | boolean | null | (string | number | boolean | null)[] | Record<number, string | boolean | number | null | (string | boolean | number | null)[]>) => Promise<string[]>;
63
+ /**
64
+ * Asynchronously appends data to the beginning of a file.
65
+ *
66
+ * @param filePath - Path of the file to append to.
67
+ * @param data - Data to append. Can be a string, number, or an array of strings/numbers.
68
+ * @returns Promise<string[]>. Modifies the file by appending data.
69
+ *
70
+ */
71
+ export declare const append: (filePath: string, data: string | number | (string | number)[]) => Promise<string[]>;
72
+ /**
73
+ * Asynchronously removes specified lines from a file.
74
+ *
75
+ * @param filePath - Path of the file from which lines are to be removed.
76
+ * @param linesToDelete - A single line number or an array of line numbers to be deleted.
77
+ * @returns Promise<string[]>. Modifies the file by removing specified lines.
78
+ *
79
+ * Note: Creates a temporary file during the process and replaces the original file with it after removing lines.
80
+ */
81
+ export declare const remove: (filePath: string, linesToDelete: number | number[]) => Promise<string[]>;
82
+ /**
83
+ * Asynchronously searches a file for lines matching specified criteria, using comparison and logical operators.
84
+ *
85
+ * @param filePath - Path of the file to search.
86
+ * @param operator - Comparison operator(s) for evaluation (e.g., '=', '!=', '>', '<').
87
+ * @param comparedAtValue - Value(s) to compare each line against.
88
+ * @param logicalOperator - Optional logical operator ('and' or 'or') for combining multiple comparisons.
89
+ * @param fieldType - Optional type of the field to guide comparison.
90
+ * @param fieldChildrenType - Optional type for child elements in array inputs.
91
+ * @param limit - Optional limit on the number of results to return.
92
+ * @param offset - Optional offset to start returning results from.
93
+ * @param readWholeFile - Flag to indicate whether to continue reading the file after reaching the limit.
94
+ * @param secretKey - Optional secret key for decoding, can be a string or Buffer.
95
+ * @returns Promise resolving to a tuple:
96
+ * 1. Record of line numbers and their content that match the criteria or null if none.
97
+ * 2. The count of found items or processed items based on the 'readWholeFile' flag.
98
+ *
99
+ * Note: Decodes each line for comparison and can handle complex queries with multiple conditions.
100
+ */
101
+ export declare const search: (filePath: string, operator: ComparisonOperator | ComparisonOperator[], comparedAtValue: string | number | boolean | null | (string | number | boolean | null)[], logicalOperator?: "and" | "or", fieldType?: FieldType | FieldType[], fieldChildrenType?: FieldType | FieldType[], limit?: number, offset?: number, readWholeFile?: boolean, secretKey?: string | Buffer) => Promise<[
102
+ Record<number, string | number | boolean | null | (string | number | boolean | null)[]> | null,
103
+ number,
104
+ Set<number> | null
105
+ ]>;
106
+ /**
107
+ * Asynchronously counts the number of lines in a file.
108
+ *
109
+ * @param filePath - Path of the file to count lines in.
110
+ * @returns Promise<number>. The number of lines in the file.
111
+ *
112
+ * Note: Reads through the file line by line to count the total number of lines.
113
+ */
114
+ export declare const count: (filePath: string) => Promise<number>;
115
+ /**
116
+ * Asynchronously calculates the sum of numerical values from specified lines in a file.
117
+ *
118
+ * @param filePath - Path of the file to read.
119
+ * @param lineNumbers - Optional specific line number(s) to include in the sum. If not provided, sums all lines.
120
+ * @returns Promise<number>. The sum of numerical values from the specified lines.
121
+ *
122
+ * Note: Decodes each line as a number using the 'decode' function. Non-numeric lines contribute 0 to the sum.
123
+ */
124
+ export declare const sum: (filePath: string, lineNumbers?: number | number[]) => Promise<number>;
125
+ /**
126
+ * Asynchronously finds the maximum numerical value from specified lines in a file.
127
+ *
128
+ * @param filePath - Path of the file to read.
129
+ * @param lineNumbers - Optional specific line number(s) to consider for finding the maximum value. If not provided, considers all lines.
130
+ * @returns Promise<number>. The maximum numerical value found in the specified lines.
131
+ *
132
+ * Note: Decodes each line as a number using the 'decode' function. Considers only numerical values for determining the maximum.
133
+ */
134
+ export declare const max: (filePath: string, lineNumbers?: number | number[]) => Promise<number>;
135
+ /**
136
+ * Asynchronously finds the minimum numerical value from specified lines in a file.
137
+ *
138
+ * @param filePath - Path of the file to read.
139
+ * @param lineNumbers - Optional specific line number(s) to consider for finding the minimum value. If not provided, considers all lines.
140
+ * @returns Promise<number>. The minimum numerical value found in the specified lines.
141
+ *
142
+ * Note: Decodes each line as a number using the 'decode' function. Considers only numerical values for determining the minimum.
143
+ */
144
+ export declare const min: (filePath: string, lineNumbers?: number | number[]) => Promise<number>;
145
+ export declare function createWorker(functionName: "get" | "remove" | "search" | "replace" | "sum" | "min" | "max" | "append" | "count", arg: any[]): Promise<any>;
146
+ /**
147
+ * Asynchronously sorts the lines in a file in the specified direction.
148
+ *
149
+ * @param filePath - Path of the file to be sorted.
150
+ * @param sortDirection - Direction for sorting: 1 or 'asc' for ascending, -1 or 'desc' for descending.
151
+ * @param lineNumbers - Optional specific line numbers to sort. If not provided, sorts all lines.
152
+ * @param _lineNumbersPerChunk - Optional parameter for handling large files, specifying the number of lines per chunk.
153
+ * @returns Promise<void>. Modifies the file by sorting specified lines.
154
+ *
155
+ * Note: The sorting is applied either to the entire file or to the specified lines. Large files are handled in chunks.
156
+ */
157
+ export declare const sort: (filePath: string, sortDirection: 1 | -1 | "asc" | "desc", lineNumbers?: number | number[], _lineNumbersPerChunk?: number) => Promise<void>;
158
+ export default class File {
159
+ static get: typeof get;
160
+ static remove: (filePath: string, linesToDelete: number | number[]) => Promise<string[]>;
161
+ static search: (filePath: string, operator: ComparisonOperator | ComparisonOperator[], comparedAtValue: string | number | boolean | (string | number | boolean | null)[] | null, logicalOperator?: "and" | "or" | undefined, fieldType?: FieldType | FieldType[] | undefined, fieldChildrenType?: FieldType | FieldType[] | undefined, limit?: number | undefined, offset?: number | undefined, readWholeFile?: boolean | undefined, secretKey?: string | Buffer | undefined) => Promise<[Record<number, string | number | boolean | (string | number | boolean | null)[] | null> | null, number, Set<number> | null]>;
162
+ static replace: (filePath: string, replacements: string | number | boolean | (string | number | boolean | null)[] | Record<number, string | number | boolean | (string | number | boolean | null)[] | null> | null) => Promise<string[]>;
163
+ static encode: (input: string | number | boolean | (string | number | boolean | null)[] | null) => string | number | boolean | null;
164
+ static decode: (input: string | number | null, fieldType?: FieldType | FieldType[] | undefined, fieldChildrenType?: FieldType | FieldType[] | undefined, secretKey?: string | Buffer | undefined) => string | number | boolean | (string | number | boolean | null)[] | null;
165
+ static isExists: (path: string) => Promise<boolean>;
166
+ static sum: (filePath: string, lineNumbers?: number | number[] | undefined) => Promise<number>;
167
+ static min: (filePath: string, lineNumbers?: number | number[] | undefined) => Promise<number>;
168
+ static max: (filePath: string, lineNumbers?: number | number[] | undefined) => Promise<number>;
169
+ static append: (filePath: string, data: string | number | (string | number)[]) => Promise<string[]>;
170
+ static count: (filePath: string) => Promise<number>;
171
+ static write: (filePath: string, data: any, disableCompression?: boolean) => Promise<void>;
172
+ static read: (filePath: string, disableCompression?: boolean) => Promise<string>;
173
+ static lock: (folderPath: string, prefix?: string | undefined) => Promise<void>;
174
+ static unlock: (folderPath: string, prefix?: string | undefined) => Promise<void>;
175
+ static createWorker: typeof createWorker;
176
+ }