Skip to content

Instantly share code, notes, and snippets.

@changtimwu
Created January 19, 2012 08:47
Show Gist options
  • Select an option

  • Save changtimwu/1638829 to your computer and use it in GitHub Desktop.

Select an option

Save changtimwu/1638829 to your computer and use it in GitHub Desktop.
An example to demostrate how to use js-yaml
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