@srzorro/file-json
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

file-json

npm i @srzorro/file-json

For when you want to store stuff in a json file, but also want to read and write it easily.

Usage

import FileJson from "@srzorro/file-json";

interface IJson {
    name: string;
    version: string;
    isEnabled: boolean;
}

const json = new FileJson<IJson>("config.json");

(async () => {
    // Read
    await json.r();

    // Data container
    console.log(json.d);

    // Edit data
    json.d.isEnabled = true;

    // Write
    await json.w();
})();

Readme

Keywords

none

Package Sidebar

Install

npm i @srzorro/file-json

Weekly Downloads

0

Version

1.1.0

License

MIT

Unpacked Size

3.69 kB

Total Files

6

Last publish

Collaborators

  • srzorro