I am having a problem when trying to use js-yaml in my node.js application.
My code (in coffeescript, but I believe it's readable for ordinary javascript users) looks like this:
loadConfig: (path, callback = false) =>
fs.readFile path, 'utf8', (err, data) =>
console.log data
throw err if err
@config = yaml.eval data #freezes here as mentioned below
console.log @config
When trying to parse a yaml config file like this:
foo: bar
Everything goes as expected. But when I change it to look like this:
foo:
bar: baz
or even:
# bla bla
foo: bar
my function freezes without any errors. The second console.log
isn't reached. After some time spent frozen, the app kills itself.
I tried changing line ending formats to no avail. Does anyone know what would be the cause of the problem or how to debug/troubleshoot it?