Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/popomore/configy
a configuration file parser
https://github.com/popomore/configy
Last synced: about 2 months ago
JSON representation
a configuration file parser
- Host: GitHub
- URL: https://github.com/popomore/configy
- Owner: popomore
- Created: 2012-12-07T01:48:27.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2013-03-09T08:45:20.000Z (almost 12 years ago)
- Last Synced: 2024-11-09T02:37:31.807Z (2 months ago)
- Language: JavaScript
- Size: 172 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.md
Awesome Lists containing this project
README
# Configy
A configuration file parser supporting properties, ini, ymal.
---
You can get the property simply.
```
configy.file('sample.properties').get('name');
// => value of the name key
```You can specify the type for configuration file.
```
var file = configy.file('sample.properties', 'properties');
file.set('name', 'popomore');
file.get('name'); // => popomore
```Support types, properties by default
- properties
- ini
- ymal(TODO)Ini support section, you can
```
configy.file('sample.txt', 'ini').set('user.name', 'popomore');
```And sample.txt will output
```
[user]
name = popomore
```## API
### .file(file, type)
Read file and return a parser. You can use getter/setter, it will sync the file.
#### Event: complete
Trigger after writing file
### .parse(str, type)
You can parse string to json。
```
var data = fs.readFileSync('sample.properties');
configy.parse(data.toString());
```## LISENCE
MIT