sidecar
Install the required plugins:
tynd add sidecartynd add processimport { sidecar } from "@tynd/plugin-sidecar/client";Registry of binaries extracted from the TYNDPKG sidecar/* section at startup.
path(name): Promise<string>
Section titled “path(name): Promise<string>”Returns the extracted on-disk path of a sidecar. Throws if no sidecar by that name was packed.
const ffmpegPath = await sidecar.path("ffmpeg.exe");list(): Promise<Array<{ name: string; path: string }>>
Section titled “list(): Promise<Array<{ name: string; path: string }>>”Enumerate every registered sidecar with its extracted path.
const all = await sidecar.list();// [{ name: "ffmpeg.exe", path: "/tmp/tynd-xxxx/sidecar/ffmpeg.exe" }, …]Declare at build time
Section titled “Declare at build time”sidecars: [ { name: "ffmpeg.exe", path: "bin/ffmpeg.exe" }, { name: "yt-dlp", path: "bin/yt-dlp" },]name— what your runtime code queries by.path— where the binary lives at build time (relative to project root).
Execute via process.exec
Section titled “Execute via process.exec”import { sidecar } from "@tynd/plugin-sidecar/client";import { process } from "@tynd/plugin-process/client";
const ffmpeg = await sidecar.path("ffmpeg.exe");const { stdout, code } = await process.exec(ffmpeg, { args: ["-i", input, "-c:v", "libx264", output],});What happens under the hood
Section titled “What happens under the hood”At launch, the Rust host walks TYNDPKG and, for every entry under sidecar/:
- Extracts the bytes to
<temp_dir>/sidecar/<name>. - On Unix, chmods +755.
- Registers the path under its
namein the host’s sidecar registry.
sidecar.path(name) looks up the map.
Platform-specific binaries
Section titled “Platform-specific binaries”Cross-compilation isn’t supported. CI matrix pattern — stage the right binary per host before tynd build:
- name: Stage sidecar for this host shell: bash run: | case "${{ matrix.target }}" in windows-x64) curl -L -o bin/ffmpeg.exe https://…/ffmpeg-win-x64.exe ;; linux-x64) curl -L -o bin/ffmpeg https://…/ffmpeg-linux-x64 ;; macos-arm64) curl -L -o bin/ffmpeg https://…/ffmpeg-macos-arm64 ;; esacSee the Sidecars guide.
- Sidecars are not zstd-compressed in TYNDPKG — they’re already-compressed formats.
- They inflate your final binary by their uncompressed size.
- On macOS, a signed outer
.appdoesn’t extend its signature to extracted sidecars; sign them separately or accept Gatekeeper prompts.
Related
Section titled “Related”- process — invoke the sidecar.
- terminal — long-running sidecars streaming stdout.
- TYNDPKG format.