Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/renatoalencar/caki
Caki is a library that provides a simple interface to read handwritten config files.
https://github.com/renatoalencar/caki
c configuration gyp hacktoberfest javascript nodejs
Last synced: about 1 month ago
JSON representation
Caki is a library that provides a simple interface to read handwritten config files.
- Host: GitHub
- URL: https://github.com/renatoalencar/caki
- Owner: renatoalencar
- License: gpl-3.0
- Created: 2014-10-10T14:06:31.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2018-07-22T10:35:40.000Z (over 6 years ago)
- Last Synced: 2024-12-08T03:49:30.996Z (2 months ago)
- Topics: c, configuration, gyp, hacktoberfest, javascript, nodejs
- Language: C
- Homepage:
- Size: 108 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Caki
Caki is a library that provides a simple interface that reads handwritten config files.
## Quickstart
* Comments begin with a `#`
* Comments are ignored
* Empty spaces are ignored
* Empty lines are ignored
* Identifiers (keys) are `[_a-zA-Z0-9]+`
* You can use integers and floatsComments begin with a '#', eg.:
```
# This is a comment
```Each node is a pair of a key and a value, like:
```
;
```You can declare subnodes too:
```
{
;
;
.
.
.
}
```You must put a semicollon (`;`) at the end of line.
Example file:
```conf
# This is an example file
name "George Lucas";
login {
username "root";
password "123456";
}pi 3.14159;
bits 32;```
Then you can import and parse it:
```js
const caki = require('caki');
const fs = require('fs');const fileContent = fs.readFileSync('example.txt');
const example = caki.parse(fileContent);
console.log(JSON.stringify(example, undefined, 2));
```## LICENSE
[MIT](./LICENSE)