Jobs¶
Run multi-second or multi-minute work such as media transcoding, playlist downloads, batch image conversion or external CLI pipelines as a job. Jobs display progress in Curio's persistent toast bar, keep running if a plugin window closes and let the user cancel the work at any time.
External tools¶
Instead of hardcoding executable paths or searching the filesystem, declare supported CLI tools in plugin.json under tools[]:
Query tool.list at runtime to check which tools are installed and direct users to Settings › Plugins › Tools (or the tool's homepage) when one is missing.
Supported tools¶
Curio locates seven standard CLI tools by checking the user's custom override in Settings › Plugins › Tools, Curio's bundled FFmpeg (for ffmpeg and ffprobe on Windows), system PATH and standard package manager directories (WinGet, Scoop, Chocolatey, Homebrew and ~/.local/bin):
Tool name |
Display title | Purpose |
|---|---|---|
ffmpeg |
FFmpeg | Video, audio and animated image conversion |
ffprobe |
FFprobe | Media container and stream inspection |
yt-dlp |
yt-dlp | Downloading video and audio from web pages |
gallery-dl |
gallery-dl | Downloading image galleries and collections |
exiftool |
ExifTool | Photo, video and document metadata reading and writing |
magick |
ImageMagick | Command-line image conversion and processing |
7z |
7-Zip | Archive inspection and extraction |
Curio never downloads third-party tools. Users install them or point Curio at an existing binary in Settings › Plugins › Tools.
process.run¶
With exec, call process.run from any plugin page or program to spawn a declared tool or a bundled program:
const { job, folder } = await curio.process.run({
tool: 'yt-dlp',
args: ['--newline', '-o', '%(title)s.%(ext)s', url],
title: 'Downloading video',
})
Run folder¶
Every process.run invocation provides:
- Temporary working directory: Returned as
folderand passed in the child environment asCURIO_RUN_FOLDER. Curio deletes the directory 24 hours later. CURIO_JOB: Active job ID, letting the spawned script calljob.updateto report percentage progress to Curio's progress bar.- API credentials:
CURIO_API_URL,CURIO_API_TOKENandCURIO_PLUGINfor live API calls.
Streaming output¶
- Short runs: Pass
wait: true(waits up to 120 seconds) to receive{ state, code, stdout, stderr, folder }in oneawait. - Long runs: Leave
wait: falseand listen tojob.output(lines split on both\nand\rso CLI progress bars stream live) andjob.finished.
const sub = curio.subscribe({ events: ['job.output', 'job.finished'] }, async (ev) => {
if (ev.name === 'job.output' && ev.data.job === job) {
appendLog(ev.data.lines)
}
if (ev.name === 'job.finished' && ev.data.id === job) {
sub.close()
if (ev.data.state === 'done') console.log('Finished:', ev.data.result)
}
})
Progress & cancel¶
When your plugin runs multi-step work inside a page without process.run (for example batch Canvas image conversion), track progress with job.start, job.update and job.finish:
const { job } = await curio.job.start({ title: 'Converting images', total: items.length })
try {
for (let i = 0; i < items.length; i++) {
const { cancelled } = await curio.job.update({ job, done: i, text: items[i].name })
if (cancelled) return
await convertOne(items[i])
}
await curio.job.finish({ job, result: { count: items.length } })
} catch (err) {
await curio.job.finish({ job, error: err.message })
}
When a user clicks Cancel on a process.run job (or your plugin calls job.cancel), Curio terminates the process and its entire child process tree immediately.
Import & cleanup¶
Import files written inside folder (CURIO_RUN_FOLDER) into the library with item.add.fromPaths (move: true) using only files.write. Curio allows importing from the run folder without files.outside while the job runs and for 10 minutes after it completes: