json-update-data

1.0.0 • Public • Published

Node.js - json-update-data

You can use this module for updating your json files in easiest way :)

Installation

Install json-update-data

  npm install json-update-data

Write data

const Jud = require("json-update-data");
const file = "/tmp/data.json";
const data = [
  {name: "Jeff"}
];
Jud.writeData(file, data);

Add new data

const Jud = require("json-update-data");
const file = "/tmp/data.json";
const newData = [
  {name: "Jeff"}
];
Jud.pushData(file, newData);

Delete data

const Jud = require("json-update-data");
const file = "/tmp/data.json";
// 2nd parameter : key name in object
// 3nd parameter : Value that assigned to that key
Jud.deleteData(file, "name", "Jeff");

Delete all data

const Jud = require("json-update-data");
const file = "/tmp/data.json";
// 2nd parameter : key name in object
// 3nd parameter : Value that assigned to that key
Jud.deleteAllData(file, "name", "Jeff");

Authors

Package Sidebar

Install

npm i json-update-data

Weekly Downloads

4

Version

1.0.0

License

ISC

Unpacked Size

3.02 kB

Total Files

3

Last publish

Collaborators

  • nima_beheshtaein