Skip to content
/ JSONFile Public

Asynchronous Node.js JSON file reader, writer, and modifier.

Notifications You must be signed in to change notification settings

XTP3/JSONFile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

JSONFile

Asynchronous Node.js JSON file reader, writer, and modifier.

Usage

Initialize:
const jsonFile = await new JSONFile(filePath, initialData);

Read:
const data = await jsonFile.read();

Write:
await jsonFile.write({foo: 'bar'});

Modify:
await jsonFile.modify({foo: 'car'});

Example:

const jsonFile = await new JSONFile('./Data.json', {
  "name": "John",
  "age": 35,
  "email": "[email protected]",
  "phone": "+1-123-456-7890",
  "address": {
    "street": "123 Main St",
    "city": "Anytown",
    "state": "CA",
    "zip": "12345"
  }
});

await jsonFile.modify({name: "Alex", available: true});
console.log(await jsonFile.read());

About

Asynchronous Node.js JSON file reader, writer, and modifier.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published