generated from CodecoolArchive/async-workshop-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask14.js
More file actions
20 lines (14 loc) · 656 Bytes
/
task14.js
File metadata and controls
20 lines (14 loc) · 656 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { readFile } from 'fs/promises'
/*
- Create a function, that opens the quotes.txt and read its content and log it to the console.
- You can choose between the then and the async-await syntax.
- If the there is an error during the read, write a fridenly error message to the console.
(you can test it, if you try to open a non existent file)
- use node.js's readFile() function's promise version.
syntax: readFile(path: string, encoding: string): Promise<string>
example; readFile('./some-file.txt', 'utf8')
Goal: Apply the promise theory to real life library usage with error handling.
*/
const task = () => {
}
task()