Node.js provides us with a native module called File Sytem (Docs), which will let you browse through files, thus reading and writing files. First, you should require the module, by adding
const fs = require('fs') in your code. For your problem, you will be interested in using the
readFileSync() method, which uses the path as first argument, and because you’re looking for reading .txt files, you should use the encoding, set it to
Here’s a simple example:
const fs = require('fs');
const path = "./Storage/fileName.txt";
const content = fs.readFileSync(path, 'utf-8');
This should hopefully help you!