Ir al contenido
#0849
Pipe

The Export button downloads a file that hasn't finished existing

A customer clicks Export on a table with four million rows. The usual shape: a worker writes a CSV to a temp directory, uploads it to a bucket, mints a presigned URL, and a lifecycle rule deletes it next week.

Your Export button is an anchor tag. Its href is a pipe path with a random suffix: /api/v1/pipe/export-8813f2?filename=orders-2026-08.csv. The click connects the receiver first; the server holds it, up to five minutes, until a sender shows up. Your backend sees the click, runs the query, and pipes the rows out: ... | curl -T - .../export-8813f2. The ?filename makes the response a download with the name you chose. Bytes flow from the query to the browser the moment both ends are connected. Nothing lands on a disk in the middle.

The file was never a file, just a query with a filename on it.