<commit_before># simple-js

A simple JSON store for node.js.

[![Build Status](https://secure.travis-ci.org/flosse/simple-js.png)](http://travis-ci.org/flosse/simple-js)

WARNING:
Don't use it if you want to persist a large amount of objects.
Use a real DB instead.

## Install

    npm install simple-js

## Usage

```javascript
var Store = require("simple-js");
var db = new Store("data");

var d = {
  foo: "bar"
};

// save with custom ID
db.save("anId", d, function(err){
  // now the data is stored in the file data/anId.json
});

// save with generated ID
db.save(d, function(err, id){
  // id is a unique ID
});

db.get("anId", function(err, obj){
  // obj = { foo: "bar" }
})

db.all(function(err, objs){
  // objs is a map: ID => OBJECT
});

db.delete("myId", function(err){
  // the file data/myId.json was removed
});
```

### Single file mode

If you want to store all objects in a single file, just set the `single` flag:

```javascript
var db = new Store("data",{single:true});
```

or point to a JSON file:

```javascript
var db = new Store("./path/to/data.json");
```

## License

This project is licensed under the MIT License.<commit_msg>updated doc<commit_after># simple-js

A simple JSON store for node.js.

[![Build Status](https://secure.travis-ci.org/flosse/simple-js.png)](http://travis-ci.org/flosse/simple-js)

WARNING:
Don't use it if you want to persist a large amount of objects.
Use a real DB instead.

## Install

    npm install simple-js

## Usage

```javascript
var Store = require("simple-js");
var db = new Store("data");

var d = {
  foo: "bar"
};

// save with custom ID
db.save("anId", d, function(err){
  // now the data is stored in the file data/anId.json
});

// save with generated ID
db.save(d, function(err, id){
  // id is a unique ID
});

// save synchronously
var id = db.saveSync("anId", d);

db.get("anId", function(err, obj){
  // obj = { foo: "bar" }
})

// get synchronously
var obj = db.get("anId");

// get all available objects
db.all(function(err, objs){
  // objs is a map: ID => OBJECT
});

// get all synchronously
var objs = db.allSync()

// delete by ID
db.delete("myId", function(err){
  // the file data/myId.json was removed
});

// delete synchronously
db.delete("myId");
```

### Single file mode

If you want to store all objects in a single file, just set the `single` flag:

```javascript
var db = new Store("data",{single:true});
```

or point to a JSON file:

```javascript
var db = new Store("./path/to/data.json");
```

## License

This project is licensed under the MIT License.
{'fraction_non_alphanumeric': 0.1655577299412916, 'fraction_numerical': 0.0, 'mean_word_length': 3.4842105263157896, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '437400', 'n_tokens_mistral': 902, 'n_tokens_neox': 877, 'n_words': 305}