Skip to content

Commit

Permalink
polyfill readFile promise
Browse files Browse the repository at this point in the history
  • Loading branch information
GaryB432 committed Nov 25, 2021
1 parent 95c8da4 commit 2e5eab4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/cli/src/info.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { readFile } from 'fs/promises';
import { PathOrFileDescriptor, readFile as rf } from 'fs';
import { dirname, posix } from 'path';
import { tablify } from './markdown';
import { InfoOptions } from './types';
Expand All @@ -21,6 +21,15 @@ interface PackageConfig {
version: string;
}

async function readFile(path: PathOrFileDescriptor): Promise<Buffer> {
return new Promise((resolve, reject) => {
rf(path, (e, buff) => {
if (e) reject(e);
resolve(buff);
});
});
}

export class Info {
public constructor(private options: InfoOptions) {
if (this.options.verbose) {
Expand Down

0 comments on commit 2e5eab4

Please sign in to comment.