chapter 2: initial samples
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
const fs = require("fs").promises;
|
||||
const path = require('path');
|
||||
|
||||
const filepath = path.join(process.cwd(), 'hello.txt');
|
||||
|
||||
async function run() {
|
||||
try {
|
||||
const contents = await fs.readFile(filepath, 'utf8');
|
||||
console.log("File Contents:", contents);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
|
||||
run();
|
||||
Reference in New Issue
Block a user