(
pathname: string,
content: string | Buffer,
extension?: string,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
options: BufferEncoding | { encoding?: BufferEncoding } | undefined | any = 'utf-8'
)
| 22 | } |
| 23 | |
| 24 | export const writeFile = ( |
| 25 | pathname: string, |
| 26 | content: string | Buffer, |
| 27 | extension?: string, |
| 28 | // eslint-disable-next-line @typescript-eslint/no-explicit-any |
| 29 | options: BufferEncoding | { encoding?: BufferEncoding } | undefined | any = 'utf-8' |
| 30 | ): Promise<void> => { |
| 31 | if (!pathname) { |
| 32 | return Promise.reject(new Error('[ERROR] Cannot save file without path.')) |
| 33 | } |
| 34 | pathname = !extension || pathname.endsWith(extension) ? pathname : `${pathname}${extension}` |
| 35 | |
| 36 | // eslint-disable-next-line @typescript-eslint/no-explicit-any |
| 37 | return outputFile(pathname, content as any, options) |
| 38 | } |
no outgoing calls
no test coverage detected