Skip to content

Commit

Permalink
Use fs.promises.readFile instead of promisify(fs.readFile) (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker committed Jan 12, 2022
1 parent 79765fb commit 60b7116
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions gitignore.js
@@ -1,5 +1,4 @@
import process from 'node:process';
import {promisify} from 'node:util';
import fs from 'node:fs';
import path from 'node:path';
import fastGlob from 'fast-glob';
Expand All @@ -13,8 +12,6 @@ const DEFAULT_IGNORE = [
'**/.git',
];

const readFileP = promisify(fs.readFile);

const mapGitIgnorePatternTo = base => ignore => {
if (ignore.startsWith('!')) {
return '!' + path.posix.join(base, ignore.slice(1));
Expand Down Expand Up @@ -62,7 +59,7 @@ const getIsIgnoredPredicate = (ignores, cwd) => p => ignores.ignores(slash(path.

const getFile = async (file, cwd) => {
const filePath = path.join(cwd, file);
const content = await readFileP(filePath, 'utf8');
const content = await fs.promises.readFile(filePath, 'utf8');

return {
cwd,
Expand Down

0 comments on commit 60b7116

Please sign in to comment.