import { outputFile } from 'fs-extra' ; param filePath param fileContent returns export function writeFile ( filePath , fileContent ) { return new Promise < void > ( ( resolve , reject ) => { const preparedFileContent = typeof fileContent === 'string' ? fileContent : `${ JSON . stringify ( fileContent , null , '	' ) }\n` ; outputFile ( filePath , preparedFileContent , 'utf-8' , ( writeFileError ) => { if ( writeFileError ) { reject ( new Error ( `An error occured while reading the file "${ filePath }". [Code "${ writeFileError . code }", Number "${ writeFileError . errno }"]` ) ) ; return ; } resolve ( ) ; } ) ; } ) ; }