function writeToFileSync({ dirPath, fileName, data }) {
  try {
    if (!fs.existsSync(dirPath)) {
      fs.mkdirSync(dirPath, { recursive: true })
    }
    const filePath = path.resolve(dirPath, fileName)
    fs.writeFileSync(filePath, data, 'utf8')
  } catch (err) {
    console.error('Error writing file:', err)
  }
}
/**
 * writeToFileSync syncronously writes data to a file.
 *
 * @param {string}        dirPath  The directory to write to
 * @param {string}        fileName The name of the file to write to
 * @param {string|Buffer} data The data to write
 */
writeToFileSync syncronously writes data to a file.
@param {string}        dirPath  The directory to write to
@param {string}        fileName The name of the file to write to
@param {string|Buffer} data The data to write
writeToFileSync syncronously writes data to a file . @param { string } dirPath The directory to write to @param { string } fileName The name of the file to write to @param { string|Buffer } data The data to write
function writeToFileSync({ dirPath, fileName, data }) {
  try {
    if (!fs.existsSync(dirPath)) {
      fs.mkdirSync(dirPath, { recursive: true })
    }
    const filePath = path.resolve(dirPath, fileName)
    fs.writeFileSync(filePath, data, 'utf8')
  } catch (err) {
    console.error('Error writing file:', err)
  }
}
function writeToFileSync ( { dirPath , fileName , data } ) { try { if ( ! fs . existsSync ( dirPath ) ) { fs . mkdirSync ( dirPath , { recursive : true } ) } const filePath = path . resolve ( dirPath , fileName ) fs . writeFileSync ( filePath , data , 'utf8' ) } catch ( err ) { console . error ( 'Error writing file:' , err ) } }
writeToFileSync syncronously writes data to a file.
writeToFileSync syncronously writes data to a file .