1.0.1 • Published 1 year ago
p-js-rs v1.0.1
pjs (JSON File Helper)
pjs is a helper class for reading and writing JSON data to files in JavaScript/Node.js.
Installation
npm i p-js-rs
import {pjs} from 'p-js';
// Example usage
const data = [
{ name: 'John', age: 30 },
{ name: 'Alice', age: 25 },
{ name: 'Bob', age: 35 }
];
// Write JSON data to a file
pjs.write(data, 'output')
.then(() => {
// Read JSON data from the file
return pjs.read('output.json');
})
.then((jsonData) => {
console.log('Read JSON data:', jsonData);
})
.catch((err) => {
console.error('Error:', err);
});
1.0.1
1 year ago