We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 92d70e9 commit fbbcd06Copy full SHA for fbbcd06
packages/app/src/app/utils/fs.ts
@@ -0,0 +1,30 @@
1
+import * as fs from 'fs';
2
+
3
+export function readFilePromise(
4
+ path: string | number | Buffer | import('url').URL,
5
+ options?: { encoding?: string; flag?: string }
6
+): Promise<string | Buffer> {
7
+ return new Promise((resolve, reject) => {
8
+ fs.readFile(path, options, (err, data) => {
9
+ if (err) {
10
+ reject(err);
11
+ return;
12
+ }
13
14
+ resolve(data);
15
+ });
16
17
+}
18
19
+export function readdirPromise(path: fs.PathLike): Promise<string[]> {
20
21
+ fs.readdir(path, (err, files) => {
22
23
24
25
26
27
+ resolve(files);
28
29
30
0 commit comments