Download many files, or a whole folder, as one zip. Fileboy builds the zip while it sends it, from the dashboard or your server.
On your app's Files page, tick the files you want (across pages if you like) and press Download zip. Inside a folder, the download button next to the folder's name zips the folder and every folder inside it. The download starts straight away and comes straight from Fileboy's API, so it works for big zips too.
POST /files/zipPOST /files/zip/linkidsfolderIdfolderPathrecursivefolderId: null/and optionally
structurefoldersflatfilenameallowMissingexpiresIn// on your server, with the private key
await fileboy.downloadZipToPath({ ids: [photoId, invoiceId], filename: "order-42" }, "order-42.zip")
// a folder and everything in it, streamed on to your own response
const zip = await fileboy.downloadZip({ folderPath: "/Products/Shoes" })
zip.pipe(res)
// or a link the browser downloads straight from Fileboy, for ten minutes
const link = await fileboy.createZipLink({ ids, structure: "flat", expiresIn: 600 })
res.redirect(link.url)# on your server, with the private key
fileboy.download_zip("order-42.zip", [photo_id, invoice_id])
fileboy.download_zip("shoes.zip", folder_path: "/Products/Shoes")
link = fileboy.create_zip_link(ids, structure: :flat, expires_in: 600)
redirect_to link.url, allow_other_host: true# on your server, with the private key
client.download_zip("order-42.zip", [photo_id, invoice_id])
client.download_zip("shoes.zip", folder_path="/Products/Shoes")
link = client.create_zip_link(ids, structure="flat", expires_in=600)
return redirect(link.url)// on your server, with the private key
$fileboy->downloadZip('order-42.zip', [$photoId, $invoiceId]);
$fileboy->downloadZip('shoes.zip', folderPath: '/Products/Shoes');
$link = $fileboy->createZipLink($ids, structure: 'flat', expiresIn: 600);
header('Location: ' . $link->url);curl -X POST https://api.fileboy.io/files/zip \
-H "Authorization: token YOUR_SIGNED_TOKEN" \
-H "Content-Type: application/json" \
-d '{"folderPath": "/Products/Shoes"}' \
-o shoes.zip
curl -X POST https://api.fileboy.io/files/zip/link \
-H "Authorization: token YOUR_SIGNED_TOKEN" \
-H "Content-Type: application/json" \
-d '{"ids": ["2a860257-ecf9-424a-846e-00ab68e2fd58"], "expiresIn": 600}'The zip comes with
Content-Disposition: attachmentX-Fileboy-Zip-FilesallowMissingX-Fileboy-Zip-MissingurlexpiresAtfilenamefileCounttotalBytesA zipped folder is the top folder of the zip, with its subfolders below it, like a folder download from Google Drive or Dropbox. Files picked by id keep their folders below the deepest folder they all share: pick three files in
/Products/Shoes/Products/Shoes/Products/HatsShoes/Hats/structure: flat_..CONphoto.jpgphoto (2).jpgOnly your app's own files. An id of another app's file, of part of a video (videos are downloaded through their own URLs), or of a file that was deleted is not found. By default that fails the whole request with
404 files_not_foundallowMissing: trueFiles set to Signed URLs only are included: the private key, and members of the app in the dashboard, can read them anyway. A zip link grants what a signed URL made with your key would, for the files it was made for, until it expires.
A zip link is a URL like
https://api.fileboy.io/zips/Zp4kQ8rT2vX6yB1nM5cH9wLsFileboy checks the request when you make the link, then looks the files up again each time it is opened. A file deleted in the meantime is left out, and a zipped folder includes files added to it since (the folder is kept by id, so renaming it changes nothing). After it expires the link answers
410 zip_link_expiredtoo_many_fileszip_too_large400 nothing_to_zipZips over 4 GB, or with files over 4 GB, use zip64, which every current unzip tool reads (Windows Explorer, macOS Archive Utility, 7-Zip,
unzipFileboy reads each file from storage and writes it into the zip as the zip goes out, so a download starts at once and big zips don't wait to be built. That also means the size isn't known in advance, so there is no
Content-LengthIf storage can't be read before the zip starts, the answer is
502 storage_errorZip downloads count the same as downloading each file on its own.