Copyright 2015 Randal L Kamradt Sr.
File Storage.
- Source:
(require("meta-data/file-storage"))(models, fileName) → {Object}
A file store API.
Parameters:
Name | Type | Description |
---|---|---|
models |
Object | The models description |
fileName |
string | The file to use as a store |
- Source:
Returns:
The API Object
- Type
- Object
Methods
(inner) add(data, done)
add an item to the store
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | The item to store |
done |
function | The callback when done |
- Source:
(inner) find(key, done)
return an item by id
Parameters:
Name | Type | Description |
---|---|---|
key |
String | The key value |
done |
function | The callback when done |
- Source:
(inner) findAll(done)
return the entire store as an Array
Parameters:
Name | Type | Description |
---|---|---|
done |
function | The callback when done |
- Source:
(inner) load(d, done)
load an array of data into a store
Parameters:
Name | Type | Description |
---|---|---|
d |
Array | The data to load |
done |
function | The callback when done |
- Source:
(inner) remove(key, done)
Remove an item by key
Parameters:
Name | Type | Description |
---|---|---|
key |
String | The key value |
done |
function | The callback when done |
- Source:
(inner) update(data, done)
update an item in the store
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | The item to store |
done |
function | The callback when done |
- Source: