Socket
Socket
Sign inDemoInstall

json-fs-store

Package Overview
Dependencies
4
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.3 to 0.0.4

2

package.json
{
"name": "json-fs-store",
"description": "File system storage and retrieval of objects as JSON",
"version": "0.0.3",
"version": "0.0.4",
"dependencies": {

@@ -6,0 +6,0 @@ "async": "^1.4.2",

@@ -6,2 +6,8 @@ This Node.js npm module simply serializes JavaScript objects to JSON files into the file system directory of your choosing.

### Installing
```
npm install json-fs-store
```
### Creating a store

@@ -32,3 +38,3 @@

// called when the file has been written
// to the /path/to/storeage/location/12345.json
// to the /path/to/storage/location/12345.json
if (err) throw err; // err if the save failed

@@ -40,9 +46,9 @@ });

To retrieve an object, you must know its `id` attribute and use it as a parameter for the `load` function.
To retrieve an object, you must know its `id` attribute and use it as a parameter for the `load()` function.
```javascript
store.load('12345', function(err, loaded_donkey){
store.load('12345', function(err, object){
if(err) throw err; // err if JSON parsing failed
// do something with loaded_donkey here
// do something with object here

@@ -54,3 +60,3 @@ });

Every call to the `#list` function reads the file system and returns the objects stored in the directory you specified when you created your store.
Every call to the `list()` function reads the file system and returns the objects stored in the directory you specified when you created your store.
Objects will be sorted according to their `name` attribute, if defined.

@@ -69,3 +75,3 @@

A stored object may be removed simply by passing the object to the `#remove` function.
A stored object may be removed simply by passing the object to the `remove()` function.
The object's `id` attribute will be used to remove the object's file from the file system.

@@ -72,0 +78,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc