Created
March 8, 2020 18:36
-
-
Save artiya4u/26a56a17252ea7abe5a8d8475a08ffe9 to your computer and use it in GitHub Desktop.
SyntaxError: await is only valid in async function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const {promisify} = require('util'); | |
const fs = require('fs'); | |
const readFileAsync = promisify(fs.readFile); | |
const filePath = 'index.js'; | |
let text = await readFileAsync(filePath, {encoding: 'utf8'}); | |
console.log(text); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment