Created
January 19, 2012 08:47
-
-
Save changtimwu/1638829 to your computer and use it in GitHub Desktop.
An example to demostrate how to use js-yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| util = require 'util' | |
| fs= require 'fs' | |
| yaml = require 'js-yaml' | |
| # pass the string | |
| fs.readFile 'example.yml', 'utf8', (err, data) -> | |
| if err | |
| console.log 'something wrong', err | |
| return | |
| try | |
| console.log util.inspect( yaml.load(data), true, null) | |
| catch e | |
| console.log e |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment