mirror of
https://github.com/cypress-io/cypress.git
synced 2026-02-06 07:10:12 -06:00
18 lines
648 B
TypeScript
18 lines
648 B
TypeScript
/* eslint-disable no-console */
|
|
|
|
import Bluebird from 'bluebird'
|
|
import fsExtra from 'fs-extra'
|
|
|
|
type Promisified<T extends (...args: any) => any>
|
|
= (...params: Parameters<T>) => Bluebird<ReturnType<T>>
|
|
|
|
interface PromisifiedFsExtra {
|
|
statAsync: (path: string | Buffer) => Bluebird<ReturnType<typeof fsExtra.statSync>>
|
|
removeAsync: Promisified<typeof fsExtra.removeSync>
|
|
readFileAsync: Promisified<typeof fsExtra.readFileSync>
|
|
writeFileAsync: Promisified<typeof fsExtra.writeFileSync>
|
|
pathExistsAsync: Promisified<typeof fsExtra.pathExistsSync>
|
|
}
|
|
|
|
export const fs = Bluebird.promisifyAll(fsExtra) as PromisifiedFsExtra & typeof fsExtra
|