Skip to content

Commit

Permalink
refactor: use fs.promises in getInputData()
Browse files Browse the repository at this point in the history
  • Loading branch information
aloisklink authored and MindaugasLaganeckas committed Jun 1, 2023
1 parent 2024c8e commit 56b5fae
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,7 @@ async function getInputData (inputFile) {
// if an input file has been specified using '-i', it takes precedence over
// piping from stdin
if (typeof inputFile !== 'undefined') {
return new Promise((resolve, reject) => fs.readFile(inputFile, 'utf-8', (err, data) => {
if (err) {
return reject(err)
}

return resolve(data)
}))
return await fs.promises.readFile(inputFile, 'utf-8')
}

return await new Promise((resolve, reject) => {
Expand Down

0 comments on commit 56b5fae

Please sign in to comment.