A simple Node.js module for performing CRUD operations on JSON files.
You can install jscrudon
via npm:
npm install jscrudon
const jscrudon = require('jscrudon');
const filePath = 'data.json';
// Create a new entry
jscrudon.createEntry(filePath, { id: 1, name: 'John Doe', age: 30 });
// Read all entries
console.log(jscrudon.readAllEntries(filePath));
// Read a specific entry
console.log(jscrudon.readEntry(filePath, 1));
// Update an entry
jscrudon.updateEntry(filePath, 1, { age: 31 });
// Delete an entry
jscrudon.deleteEntry(filePath, 1);
Creates a new entry in the JSON file specified by filePath
with the data provided in newData
.
Reads all entries from the JSON file specified by filePath
.
Reads a specific entry from the JSON file specified by filePath
based on the identifier
.
Updates a specific entry in the JSON file specified by filePath
based on the identifier
with the data provided in updatedData
.
Deletes a specific entry from the JSON file specified by filePath
based on the identifier
.
This project is licensed under the MIT License - see the LICENSE file for details.