key-file-storage
Advanced tools
Comparing version 1.1.1 to 1.1.2
{ | ||
"name": "key-file-storage", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Simple cached key-value Node.js storage directly on file system, maps each key to JSON contents of a file.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# key-file-storage | ||
Simple key-value Node.js storage directly on file system, maps each key to JSON contents of a file. | ||
### I'll soon make a detailed readme for this module, but for now I just show you some examples : | ||
#### I'll soon make a detailed readme for this module, but for now I just show you some examples : | ||
``` | ||
+ Initializing key-file storage : | ||
```javascript | ||
var keyFileStorage = require("key-file-storage"); | ||
@@ -14,3 +15,6 @@ | ||
var kfs = keyFileStorage(); | ||
``` | ||
+ Setting a new value to a key : | ||
```javascript | ||
var value = ... // Any JSON-able object | ||
@@ -29,3 +33,6 @@ | ||
}); | ||
``` | ||
+ Getting value of a key : (*Value of a not existing key will be* `null`) | ||
```javascript | ||
// Callback form : | ||
@@ -43,3 +50,6 @@ kfs.get('key', function(err, value) { | ||
}); | ||
``` | ||
+ Removing a key-file pair : | ||
```javascript | ||
// Callback form : | ||
@@ -56,3 +66,6 @@ kfs.remove('key', function(err) { | ||
}); | ||
``` | ||
+ Clearing anything in the database folder : | ||
```javascript | ||
// Callback form : | ||
@@ -71,2 +84,6 @@ kfs.clear(function(err) { | ||
NOTE: `undefined` is not supported as a savable value, but `null` is. Saving a key with value `undefined` is equivalent to remove it. | ||
NOTE: `undefined` is not supported as a savable value, but `null` is. Saving a key with value `undefined` is equivalent to remove it. | ||
NOTE: Each key will map to a separate file (*using the key itself as its relative path*) so there is no need to load all the database file for any key access. Also, keys can be relative paths, e.g: `data.json`, `/my/key/01` or `any/other/relative/path/to/a/file`. | ||
NOTE: There is a built-in implemented **cache**, so accessing a certain key once again won't require file-system level operations. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
9750
84
0