When using node.js, make sure the path exists before writing the result file(s).