how to write file to parent folder with fs of nodejs?
node.js
Solution
Yes, that should work fine. The main issue I see is that you have no `/` between the dirname and the path.
So what you have now is more like:
fs.writeFile('/tmp/module../sibling_dir/file.txt', 'test');
try this:
fs.writeFile(__dirname + '/../sibling_dir/file.txt', 'test');
Problem
I want to write a file to the current script folder's parent folder (and sometimes subdirectories to that parent folder)? How should I write the path? Can this work? ``` fs.writeFile(__dirname + '../sibling_dir/file.txt', 'test'); ```