Undefined Title

Undefined Title

How to load YAML in Node.js

I think js-yaml is a good library for loading YAML in Node.js

https://github.com/nodeca/js-yaml

npm install js-yaml

Let's say your yaml file is as "your.yml",

greeting: hello!
year: 2012

In your .js code,

var yaml = require("js-yaml");
var fs = require("fs");
var e = yaml.load(fs.readFileSync("your.yml"));
console.log(e.greeting);
console.log(e.year);