key-file-storage
Advanced tools
Comparing version 2.1.4 to 2.1.5
{ | ||
"name": "key-file-storage", | ||
"version": "2.1.4", | ||
"version": "2.1.5", | ||
"description": "Simple key-value storage directly on file system, maps each key to a separate file.", | ||
@@ -5,0 +5,0 @@ "main": "main.js", |
@@ -179,16 +179,13 @@ # key-file-storage | ||
// Locate 'db' folder in current directory as the storage path, | ||
// Locate 'db' folder in the current directory as the storage path, | ||
// Require 100 latest accessed key-values to be cached: | ||
var kfs = keyFileStorage('./db', 100); | ||
// Create file './db/users/hessam' containing this user data synchronously: | ||
// Create file './db/users/hessam' containing this user data, synchronously: | ||
kfs['users/hessam'] = { | ||
name: "Hessam", | ||
skills: { | ||
java: 10, | ||
csharp: 15 | ||
} | ||
skills: { java: 10, csharp: 15 } | ||
}; | ||
// Read file './db/users/hessam/skills' as a JSON object asynchronously: | ||
// Read file './db/users/hessam' as a JSON object, asynchronously: | ||
kfs('users/hessam').then(function(hessamData) { | ||
@@ -199,3 +196,3 @@ console.log("Hessam's java skill is ", | ||
// Check whether file './db/users/mahdiar' exists or not asynchronously: | ||
// Check whether file './db/users/mahdiar' exists or not, asynchronously: | ||
'users/mahdiar' in kfs(function(error, exists) { | ||
@@ -207,3 +204,3 @@ if(exists) { | ||
// List the file names of all users in './db/users/' synchronously: | ||
// List all the keys in './db/users/', synchronously: | ||
var allUsers = kfs['users/']; | ||
@@ -210,0 +207,0 @@ //=> ['users/hessam', 'users/mahdiar', ... ] |
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
36246
213