snowbase 6.0.0 → 6.0.2

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/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright © 2026 Pedro Henrique Brandão (p3droob)
1
+ Copyright © 2021 Pedro Henrique Brandão (p3droob)
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
4
 
package/README.md CHANGED
@@ -78,6 +78,11 @@ const db = new Snowbase();
78
78
  db.on("ready", () => {
79
79
  console.log("Database is ready");
80
80
  });
81
+
82
+ //Multiples database
83
+ const db1 = new Snowbase({ baseDir: "storage" });
84
+ const db2 = new Snowbase({ baseDir: "database" }); // creates an isolated new Snowbase storage
85
+ // You need to specify the baseDir if use the CLI
81
86
  ```
82
87
 
83
88
  ### Basic operations
@@ -221,4 +226,4 @@ snowbase has
221
226
 
222
227
  ## License
223
228
 
224
- MIT
229
+ MIT @ Pedro Henrique Brandão (p3droob)
package/bin/snowbase.js CHANGED
@@ -55,6 +55,14 @@ ${chalk.bold("SNOWBASE COMMANDS")}
55
55
 
56
56
  ${chalk.blue("clear")} Clear the database file
57
57
 
58
+ ${chalk.blue("get")} Get the value of a key
59
+
60
+ ${chalk.blue("set")} Set the value of a key
61
+
62
+ ${chalk.blue("remove")} Remove a key from the database
63
+
64
+ ${chalk.blue("has")} Check if a key exists in the database
65
+
58
66
  ============================================================
59
67
  ${chalk.bold("COMPILER OPTION")}
60
68
 
@@ -77,7 +85,17 @@ if (!cmd) {
77
85
  console.log(helpMessage);
78
86
  }
79
87
 
80
- const commands = ["init", "inspect", "backup", "clear", "restore", "get", "set", "remove", "has"];
88
+ const commands = [
89
+ "init",
90
+ "inspect",
91
+ "backup",
92
+ "restore",
93
+ "clear",
94
+ "get",
95
+ "set",
96
+ "remove",
97
+ "has",
98
+ ];
81
99
  if (cmd) {
82
100
  let config = {
83
101
  baseDir: "./snowbase",
@@ -207,10 +225,14 @@ if (cmd) {
207
225
  } else
208
226
  console.log(
209
227
  chalk.red("Decryption failed, please provide a valid secret"),
210
- 'Example: snowbase restore --secret <secret> --restoreFile <backup-ID>',
228
+ "Example: snowbase restore --secret <secret> --restoreFile <backup-ID>",
211
229
  );
212
230
  } else {
213
- console.log(chalk.red(`Backup file ${backupFile} does not exist. Check the backup ID or if the dir exists`));
231
+ console.log(
232
+ chalk.red(
233
+ `Backup file ${backupFile} does not exist. Check the backup ID or if the dir exists`,
234
+ ),
235
+ );
214
236
  }
215
237
  break;
216
238
  }
@@ -276,12 +298,14 @@ if (cmd) {
276
298
  else console.log(db.get(config.key));
277
299
  break;
278
300
  }
301
+
279
302
  case "remove": {
280
303
  let run = db.remove(config.key);
281
304
  if (run) console.log(chalk.green("Value removed successfully"));
282
305
  else console.log(chalk.red("Value not removed"));
283
306
  break;
284
307
  }
308
+
285
309
  case "has": {
286
310
  let run = db.has(config.key);
287
311
  console.log(run);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "snowbase",
3
- "version": "6.0.0",
3
+ "version": "6.0.2",
4
4
  "description": "A lightweight local JSON database for modern JavaScript projects.",
5
5
  "keywords": [
6
6
  "file-database",