2021-01-08 00:26:41 +09:00
|
|
|
import { readFile, writeFile, exists, copyFile, unlink } from 'fs'
|
2020-09-04 17:22:15 +09:00
|
|
|
import { promisify } from 'util'
|
|
|
|
|
|
|
|
export const readFileAsync = promisify(readFile)
|
|
|
|
export const writeFileAsync = promisify(writeFile)
|
|
|
|
export const existsAsync = promisify(exists)
|
2021-01-08 00:26:41 +09:00
|
|
|
export const unlinkAsync = promisify(unlink)
|
|
|
|
export const copyFileAsync = promisify(copyFile)
|
2021-08-07 01:22:53 +09:00
|
|
|
|
|
|
|
export function pick<O, K extends keyof O>(o: O, ...keys: K[]): Pick<O, K> {
|
|
|
|
return keys.reduce((acc, key) => {
|
|
|
|
acc[key] = o[key]
|
|
|
|
return acc
|
|
|
|
}, {} as O)
|
|
|
|
}
|