inibase 1.0.0-rc.5 → 1.0.0-rc.50

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
@@ -4,17 +4,21 @@
4
4
 
5
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
@@ -31,35 +35,89 @@ const users = await db.get("user", undefined, { page: 2, per_page: 15 });
31
35
 
32
36
  // Get only required columns to improve speed
33
37
  const users = await db.get("user", undefined, {
34
- columns: ["username", "address.street", "hobbies.*.name"],
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 db.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
+ - [x] Order By (using UNIX commands)
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
+ - [ ] Commenting the code
112
+ - [ ] Add property "unique" for schema fields
113
+ - [ ] Add Backup feature (generate a tar.gz)
114
+ - [ ] Add Custom field validation property to schema (using RegEx?)
115
+ - [ ] Features:
116
+ - [ ] Encryption
117
+ - [x] Data Compression
118
+ - [x] Caching System
119
+ - [ ] Suggest [new feature +](https://github.com/inicontent/inibase/discussions/new?category=ideas)
120
+
63
121
 
64
122
  ## Examples
65
123
 
@@ -226,8 +284,9 @@ const product_schema = [
226
284
  type: "number",
227
285
  },
228
286
  {
229
- key: "user",
287
+ key: "createdBy",
230
288
  type: "table",
289
+ table: "user",
231
290
  required: true,
232
291
  },
233
292
  ];
@@ -236,12 +295,12 @@ const product_data = [
236
295
  {
237
296
  title: "Product 1",
238
297
  price: 16,
239
- user: "1d88385d4b1581f8fb059334dec30f4c",
298
+ createdBy: "1d88385d4b1581f8fb059334dec30f4c",
240
299
  },
241
300
  {
242
301
  title: "Product 2",
243
302
  price: 10,
244
- user: "5011c230aa44481bf7e8dcfe0710474f",
303
+ createdBy: "5011c230aa44481bf7e8dcfe0710474f",
245
304
  },
246
305
  ];
247
306
 
@@ -251,7 +310,7 @@ const product = await db.post("product", product_data);
251
310
  // "id": "1d88385d4b1581f8fb059334dec30f4c",
252
311
  // "title": "Product 1",
253
312
  // "price": 16,
254
- // "user": {
313
+ // "createdBy": {
255
314
  // "id": "1d88385d4b1581f8fb059334dec30f4c",
256
315
  // "username": "user1",
257
316
  // "email": "user1@example.com",
@@ -262,7 +321,7 @@ const product = await db.post("product", product_data);
262
321
  // "id": "5011c230aa44481bf7e8dcfe0710474f",
263
322
  // "title": "Product 2",
264
323
  // "price": 10,
265
- // "user": {
324
+ // "createdBy": {
266
325
  // "id": "5011c230aa44481bf7e8dcfe0710474f",
267
326
  // "username": "user2",
268
327
  // ...
@@ -389,92 +448,95 @@ await db.put("user", { isActive: false });
389
448
 
390
449
  </details>
391
450
 
392
- ## Typescript
451
+ <details>
452
+ <summary>SUM</summary>
453
+
454
+ ```js
455
+ import Inibase from "inibase";
456
+ const db = new Inibase("/database_name");
457
+
458
+ // get the sum of column "age" in "user" table
459
+ await db.sum("user", "age");
460
+
461
+ // get the sum of column "age" by criteria (where "isActive" is equal to "false") in "user" table
462
+ await db.sum("user", ["age", ...], { isActive: false });
463
+ ```
464
+
465
+ </details>
466
+
467
+ <details>
468
+ <summary>MAX</summary>
469
+
470
+ ```js
471
+ import Inibase from "inibase";
472
+ const db = new Inibase("/database_name");
473
+
474
+ // get the biggest number of column "age" in "user" table
475
+ await db.max("user", "age");
476
+
477
+ // get the biggest number of column "age" by criteria (where "isActive" is equal to "false") in "user" table
478
+ await db.max("user", ["age", ...], { isActive: false });
479
+ ```
480
+
481
+ </details>
393
482
 
394
483
  <details>
395
- <summary>Schema</summary>
484
+ <summary>MIN</summary>
396
485
 
397
486
  ```js
398
- type Schema = Field[];
399
- type Field = {
400
- id?: string | number | null | undefined,
401
- key: string,
402
- required?: boolean,
403
- } & (
404
- | {
405
- type: Exclude<FieldType, "array" | "object">,
406
- required?: boolean,
407
- }
408
- | {
409
- type: "array",
410
- children: FieldType | FieldType[] | Schema,
411
- }
412
- | {
413
- type: "object",
414
- children: Schema,
415
- }
416
- );
417
- type FieldType =
418
- | "string"
419
- | "number"
420
- | "boolean"
421
- | "date"
422
- | "email"
423
- | "url"
424
- | "table"
425
- | "object"
426
- | "array"
427
- | "password";
487
+ import Inibase from "inibase";
488
+ const db = new Inibase("/database_name");
489
+
490
+ // get the smallest number of column "age" in "user" table
491
+ await db.min("user", "age");
492
+
493
+ // get the smallest number of column "age" by criteria (where "isActive" is equal to "false") in "user" table
494
+ await db.min("user", ["age", ...], { isActive: false });
428
495
  ```
429
496
 
430
497
  </details>
431
498
 
432
499
  <details>
433
- <summary>Data</summary>
500
+ <summary>createWorker</summary>
434
501
 
435
502
  ```js
436
- type Data = {
437
- id?: number | string,
438
- [key: string]: any,
439
- created_at?: Date,
440
- updated_at?: Date,
441
- };
503
+ import Inibase from "inibase";
504
+ const db = new Inibase("/database_name");
505
+
506
+ // POST 10,000 USER
507
+ await Promise.all(
508
+ [...Array(10)]
509
+ .map((x, i) => i)
510
+ .map(
511
+ (_index) =>
512
+ db.createWorker("post", [
513
+ "user",
514
+ [...Array(1000)].map((_, i) => ({
515
+ username: `username_${i + 1}`,
516
+ email: `email_${i + 1}@test.com`,
517
+ password: `password_${i + 1}`,
518
+ })),
519
+ ])
520
+ )
521
+ )
442
522
  ```
443
523
 
444
524
  </details>
445
525
 
446
- ## Roadmap
526
+ ## Config (.env)
447
527
 
448
- - [x] Actions:
449
- - [x] GET:
450
- - [x] Pagination
451
- - [x] Criteria
452
- - [x] Columns
453
- - [ ] Order By
454
- - [x] POST
455
- - [x] PUT
456
- - [x] DELETE
457
- - [ ] Schema supported types:
458
- - [x] String
459
- - [x] Number
460
- - [x] Boolean
461
- - [x] Date
462
- - [x] Email
463
- - [x] Url
464
- - [x] Table
465
- - [x] Object
466
- - [x] Array
467
- - [x] Password
468
- - [ ] IP
469
- - [ ] HTML
470
- - [ ] Markdown
471
- - [ ] TO-DO:
472
- - [ ] Improve caching
473
- - [ ] Commenting the code
474
- - [ ] Features:
475
- - [ ] Encryption
476
- - [ ] Compress data
477
- - [ ] Suggest [new feature +](https://github.com/inicontent/inibase/discussions/new?category=ideas)
528
+ The `.env` file supports the following parameters (make sure to run commands with flag --env-file=.env)
529
+
530
+ ```ini
531
+ # Auto generated secret key, will be using for encrypting the IDs
532
+ INIBASE_SECRET=
533
+
534
+ INIBASE_COMPRESSION=true
535
+ INIBASE_CACHE=true
536
+
537
+ # Prepend new items to the beginning of file
538
+ INIBASE_REVERSE=true
539
+ ```
478
540
 
479
541
  ## License
480
542
 
@@ -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, Schema } 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 'Inison.stringify' 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[] | Schema, 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[] | Schema, 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[] | Schema, 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[] | Schema | 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[] | Schema | 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
+ }