انتقل إلى المحتوى
#0827
Exec

The function has the same binaries as the box

The client wants a "download as MP4" button on their review portal. The source video lives on the container. The transcode needs ffmpeg, which is a binary, which is the one thing a function platform never has.

Exec scripts run on Bun, and Bun's $ is pre-injected. The handler is `await $ffmpeg -i ${src} -vf scale=1280:-2 -y ${out} followed by return fs.readFileSync(out). The Buffer comes back with its MIME type detected; the browser receives video/mp4. // @timeout 10m covers the long ones. // @concurrent 2 keeps two transcodes from becoming eight. Resolve src` yourself from an id: never interpolate raw user input into the shell.

Whatever you apt install in the container, the handler can call. The platform never asked which binaries you needed. The function has the same binaries as the box.

The function has the same binaries as the box.