Answers for "node import fs"

1

node import fs

import {fs} from 'fs';
Posted by: Guest on June-30-2021
2

node.js import fs

import fs from "fs";
Posted by: Guest on September-06-2021
1

read file in nodejs using fs

let myFile = "./myText.txt";
const fs = require("fs");
		
app.all('/test', async (req, res) => {
	try {
		const readData = fs.readFileSync(myFile, 'utf8');
		if (readData) {
			res.send(readData)
		}
	} catch (error) {
		res.send("something is wrong", error)
	}
})
Posted by: Guest on January-07-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language