#!/usr/bin/env node 'use strict' const {resolve} = require('path') const shell = require('any-shell-escape') const {exec} = require('child_process') const pathToFfprobe = require('.') const argv = process.argv.slice(2) if (argv.includes('-h') || argv.includes('--help')) { console.info(` This is just a simple CLI wrapper around the powerful ffprobe CLI tool. This script just showcases how to use ffprobe-static-installer; It wouldn't make sense to hide a flexible tool behind a limited wrapper script. Usage: ./example.js Example: ./example.js src-audio-file.m4a `) process.exit(0) } const [src] = argv if (!src) { console.error('Missing positional argument.') process.exit(1) } const inspect = shell([ pathToFfprobe, '-v', 'error', '-show_format', '-show_streams', '-i', resolve(process.cwd(), src), ]) exec(inspect, (err, stdout) => { if (err) { console.error(err) process.exit(1) } else { console.info(stdout) } })