src/subz-hero.js
async function downloadSubtitles (file) {
  const subtitles = await getSubtitles(file)

  const { dir, name } = path.parse(file)

  const subtitlesFile = path.format({ dir, name, ext: '.srt' })

  await fs.writeFile(subtitlesFile, subtitles)

  return subtitlesFile
}
async function downloadSubtitles (file) {
  const subtitles = await getSubtitles(file)

  const { dir, name } = path.parse(file)

  const subtitlesFile = path.format({ dir, name, ext: '.srt' })

  await fs.writeFile(subtitlesFile, subtitles)

  return subtitlesFile
}
async function downloadSubtitles ( file ) { const subtitles = await getSubtitles ( file ) const { dir , name } = path . parse ( file ) const subtitlesFile = path . format ( { dir , name , ext : '.srt' } ) await fs . writeFile ( subtitlesFile , subtitles ) return subtitlesFile }
Download subtitles for the given file and create a '.srt' file next to it,
with the same name.

@param {string} file - path to a file
@returns {Promise<string>} path to the .srt file
Download subtitles for the given file and create a . srt file next to it with the same name .