export function ffprobe(file: string): Promise<IFfprobe> {
  return new Promise<IFfprobe>((resolve, reject) => {
    if (!file) throw new Error('no file provided')

    stat(file, (err, stats) => {
      if (err) return reject(new Error('wrong file provided'))

      exec('ffprobe -v quiet -print_format json -show_format -show_streams ' + file, (error, stdout, stderr) => {
        if (error) return reject(error)
        if (!stdout) return reject(new Error("can't probe file " + file))

        let ffprobed: IFfprobe

        try {
          ffprobed = JSON.parse(stdout)
        } catch (err) {
          return reject(err)
        }

        for (let i = 0; i < ffprobed.streams.length; i++) {
          if (ffprobed.streams[i].codec_type === 'video') ffprobed.video = ffprobed.streams[i] as IVideoStream
          if (ffprobed.streams[i].codec_type === 'audio' && ffprobed.streams[i].channels)
            ffprobed.audio = ffprobed.streams[i] as IAudioStream
        }
        resolve(ffprobed)
      })
    })
  })
}
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.