eugeneware / ffmpeg-static

ffmpeg static binaries for Mac OSX and Linux and Windows
GNU General Public License v3.0
1.11k stars 182 forks source link

Proposal: Put the binary under `node_modules/.bin/` #117

Open leafac opened 1 year ago

leafac commented 1 year ago

This way we could npm install ffmpeg-static and we’d be able to npx ffmpeg. Also, tools like execa could pick up the binary without even needing to import ffmpeg from "ffmpeg-static" (using preferLocal).

This could be a backward compatible change as long as import ffmpeg from "ffmpeg-static" starts pointing into node_modules/.bin/.

I can think of one difficulty: uninstallation must remove the binary from node_modules/.bin/. But I believe that shouldn’t be big issue. I’ve done this before for a similar project I maintain using a preuninstall npm script (https://github.com/leafac/caddy/blob/92d2aa504c33b20514e64bd7a0e57313951bfb15/package.json#L27 https://github.com/leafac/caddy/blob/92d2aa504c33b20514e64bd7a0e57313951bfb15/scripts.mjs#L36-L43).

What do you think?