generated from JS-DevTools/template-node-typescript
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replaced
fs.promises.readFile()
with fs.readFile()
, since `fs.pro…
…mises` does not exist in Node 8
- Loading branch information
1 parent
d62a921
commit 4b7970a
Showing
3 changed files
with
15 additions
and
4 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import * as fs from "fs"; | ||
|
||
/** | ||
* Asynchronously reads the specified file and returns its contents as a string. | ||
*/ | ||
export async function readFile(path: string, encoding: string): Promise<string> { | ||
return new Promise((resolve, reject) => { | ||
// tslint:disable-next-line: ban | ||
fs.readFile(path, encoding, (err, contents) => err ? reject(err) : resolve(contents)); | ||
}); | ||
} |
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