Skip to content

Commit

Permalink
Use native Promise versions of fs functions where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
niklashigi committed Mar 2, 2020
1 parent 0816bd2 commit cf59952
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/utils/fs.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import * as fs from 'fs'
import { promises as fsp } from 'fs'
import { promisify } from 'util'

export const readFile = promisify(fs.readFile)
export const writeFile = promisify(fs.writeFile)
export const copyFile = promisify(fs.copyFile)
export const writeFile = fsp.writeFile
export const copyFile = fsp.copyFile
export const exists = promisify(fs.exists)
export const unlink = promisify(fs.unlink)
export const rename = promisify(fs.rename)
export const mkdir = promisify(fs.mkdir)
export const unlink = fsp.unlink
export const rename = fsp.rename
export const mkdir = fsp.mkdir

0 comments on commit cf59952

Please sign in to comment.