FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

XTP3/JSONFile: Asynchronous Node.js JSON file reader, writer, and modifier. · GitHub

/ JSONFile Public

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

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": "john@example.com",
  "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

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages


Back | FazBrowse Home | New Git URL