Sometimes, we want to get full file path in Node.js.
In this article, we’ll look at how to get full file path in Node.js.
How to get full file path in Node.js?
To get full file path in Node.js, we use the path.resolve
method.
For instance, we write
const path = require("path");
const absolutePath = path.resolve("./Uploads/MyFile.csv");
to call path.resolve
with a relative path string to return the full path of the file as a string.
Conclusion
To get full file path in Node.js, we use the path.resolve
method.