https://github.com/nemtsov/inirc
Tiny library for handling ini-based rc files.
https://github.com/nemtsov/inirc
Last synced: 3 months ago
JSON representation
Tiny library for handling ini-based rc files.
- Host: GitHub
- URL: https://github.com/nemtsov/inirc
- Owner: nemtsov
- License: mit
- Created: 2014-02-21T07:51:59.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2014-11-19T05:31:12.000Z (over 11 years ago)
- Last Synced: 2025-06-05T05:27:19.456Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 173 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
inirc [](https://travis-ci.org/nemtsov/inirc)
=====
An `ini` format `~/.rc` file management library.
Usage
-----
```javascript
var inirc = require('inirc'),
rc = inirc('.awesomerc');
rc.put({user: {name: 'heather'}}, function (err) {
if (err) throw err;
});
```
Creates a `~/.awesomerc` with the following contents:
```
[user]
name = heather
```
You can also `get` and `del`:
```javascript
rc.get(function (err, data) {
if (err) throw err;
assert(data.user.name === 'heather');
});
rc.del(function (err) {
if (err) throw err;
});
```
API
---
**initrc(name, [options])**
Creates an `rc` instance.
The option `home` is available. It defaults to the current user's home directory, which is set by the environment varialbe `HOME` in \*nix and `USERPROFILE` on win. The option `mode` will allow you to set a custom file access permission on the rc file. It defaults to `0600` (rw for the owner only).
**rc.put(configObject, cb)**
**rc.get(cb)**
**rc.del(cb)**
License
-------
MIT