Skip to content

Instantly share code, notes, and snippets.

View heypano's full-sized avatar

Pano Papadatos heypano

View GitHub Profile
@heypano
heypano / readWriteFileNodeJsPromises.js
Created July 30, 2021 16:55
Read/Write file with promises in node js
const { promises } = require("fs");
const { readFile, writeFile } = promises;
const input = "src/index.js";
const output = "src/index2.js";
const errorHandler = (error) => {
console.error(error.message);
process.exit(1);
};