jfs
A simple JSON file store written in Rust. This is a port and drop-in replacement of the Node.js library json-file-store.
WARNING: Don't use it if you want to persist a large amount of objects. Use a real DB instead.
Installation
Depending on which serialization framework you like to use,
you have to enable it by setting the corresponding features
in Cargo.toml
.
By default rustc-serialize
is used. To enable support for serde
add the following to your configuration:
[]
= "0.2"
= ["serde", "serde_json"]
= false
Example
extern crate jfs;
extern crate rustc_serialize;
use Store;
You can also store all data in one single JSON-File:
let mut cfg = default;
cfg.single = true; // false is default
let db = new_with_cfg;
If you like to pretty print the file content, set pretty
to true
and choose a number of whitespaces for the indention:
let mut cfg = default;
cfg.pretty = true; // false is default
cfg.indent = 4; // 2 is default
License
This project is licensed under the MIT License.