https://github.com/yuko1101/configfile.js
A config file management library for Node.js.
https://github.com/yuko1101/configfile.js
Last synced: 2 months ago
JSON representation
A config file management library for Node.js.
- Host: GitHub
- URL: https://github.com/yuko1101/configfile.js
- Owner: yuko1101
- License: mit
- Created: 2023-04-03T11:38:41.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-23T15:55:38.000Z (about 1 year ago)
- Last Synced: 2024-04-24T04:11:48.014Z (about 1 year ago)
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/config_file.js
- Size: 130 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ConfigFile.js
A config file management library for Node.js.## Installation
```sh-session
npm i config_file.js
```## Usage
```js
const { ConfigFile } = require("config_file.js");const config = new ConfigFile("./config.json", {});
run();
async function run() {
await config.load(); // or just config.loadSync();config.set("a", 2); // { "a": 2 }
config.set("b", 4); // { "a": 2, "b": 4 }config.get("c").set("d", []); // { "a": 2, "b": 4, "c": { "d": [] } }
config.get("c", "d").add(6); // { "a": 2, "b": 4, "c": { "d": [6] } }console.log(config.get("c", "d", 0).getValue()); // Output: 6
await config.save(); // or just config.saveSync();
}
```Also, you can edit and save in a single line.
```js
await config.set("key", "value").save();
```