A method for save json objects on disk file:
json
import { store } from 'ava-ia/lib/helpers'; const db = store('classifier.json'); const key = 'your_attribute_key'; db.get(key); db.set(key, {hello: 'world'});
// -- More info: https://github.com/typicode/lowdb 'use strict'; import lowdb from 'lowdb'; import path from 'path'; import fs from 'fs'; // -- Internal const folder = path.resolve('.', 'store'); if (!fs.existsSync(folder)) fs.mkdirSync(folder); export default (file, defaults = {}) => { const store = lowdb(`${folder}/${file}`, { storage: require('lowdb/lib/file-async') }); if (defaults) store.defaults(defaults).value(); return store; }
There was an error while loading. Please reload this page.
Feel free to offer new features, improvements or anything you can think of. This project makes sense with your participation and experience using Ava.