Top "Fs" questions

File I/O in the Node.

Writing files in Node.js

I've been trying to find a way to write to a file when using Node.js, but with no success. …

javascript node.js file express fs
Check synchronously if file/directory exists in Node.js

How can I synchronously check, using node.js, if a file or directory exists?

node.js fs
How to append to a file in Node?

I am trying to append a string to a log file. However writeFile will erase the content each time before …

javascript node.js fs appendfile
How to download a file with Node.js (without using third-party libraries)?

How do I download a file with Node.js without using third-party libraries? I don't need anything special. I only …

javascript node.js express download fs
Write / add data in JSON file using Node.js

I am trying to write JSON file using node from loop data, e.g.: let jsonFile = require('jsonfile'); for (i = 0; …

javascript json node.js fs
Node.js check if path is file or directory

I can't seem to get any search results that explain how to do this. All I want to do is …

node.js path directory filesystems fs
Node.js check if file exists

How do i check the existence of a file? In the documentation for the module fs there's a description of …

node.js fs
nodejs get file name from absolute path?

If there any API could retrieve file name from an absolute file path? e.g. "foo.txt" from "/var/www/…

node.js path fs
Copy folder recursively in Node.js

Is there an easier way to copy a folder and all its content without manually doing a sequence of fs.…

javascript node.js fs
How to refactor Node.js code that uses fs.readFileSync() into using fs.readFile()?

I'm trying to get my head around synchronous versus asynchronous in Node.js, in particular for reading an HTML file. …

node.js callback readfile fs