Data Types

Archive Processing API

Scalable archive REST API to compress and extract files using TAR, ZIP, and GZIP.

https://upcdn.io
Account
/W142hJk/
API
archive
File Path
/example.zip
Parameters
?m=extract

1 Upload your file

Firstly, your file must be uploaded or accessible to Bytescale:

Icon

Use the Bytescale Dashboard to upload a file manually.

Icon

Use the Upload Widget, Bytescale SDKs or Bytescale API to upload a file programmatically.

Icon

Use our external storage options to process external files.

2 Build your archive URL

Build an archive processing URL:

2a

Get the raw URL for your file:

https://upcdn.io/W142hJk/raw/example.zip

2b

Replace "raw" with "archive":

https://upcdn.io/W142hJk/archive/example.zip

2c

Add querystring parameters to control the output:

https://upcdn.io/W142hJk/archive/example.zip?m=extract

3 Download your file(s)

When archiving files, the response will be the archived/compressed file:

https://upcdn.io/W142hJk/archive/example.jpg?m=archive

When extracting files, the response will be a JSON object containing links to each extracted file:

https://upcdn.io/W142hJk/archive/example.zip?m=extract
{
"files": [
{
"size": 12,
"artifact": "/example-file.txt"
},
{
"size": 962594,
"artifact": "/example-image.jpeg"
}
]
}

To download each file, append &artifact=<artifact_path> to the URL:

https://upcdn.io/W142hJk/archive/example.zip?m=extract&artifact=/example-file.txt

API Reference

Use the Archive Processing API to compress and extract files on demand.

Archive Processing API requests have a 55-second timeout. This means the internal download and compression/extraction operations required to perform your request must complete within this time. This timeout is sufficient for most requests, however, when compressing multiple files using multiple file parameters, we recommend limiting each request to no more than 200 input files with a combined size of less than 2GB to avoid timeouts.

Archive Processing API URLs have a 1000-character limit. To exceed this limit, use a POST request and specify your transformation parameters via the extendedParams parameter in the request body instead of via the querystring.

The total size of the file archive and its uncompressed contents cannot exceed 10GB.

m=archive

Archives the file.

Response is the archived file, in the format specified by the out parameter.

m=extract

Extracts the file archive.

Response is a text file containing a list of file sizes and relative file paths, which you can download using the artifact query parameter.

c=<int>

Only applicable to m=archive with out=zip or out=tar.gz.

Sets the compression level for the resulting file archive.

0 = lowest compression and largest file size.

9 = highest compression and smallest file size.

Note: compression works best with uncompressed content, such as raw images, uncompressed videos, and text, as these files typically contain repeated characters and bytes that compression algorithms are good at reducing. Image formats like JPGs, PNGs and WebP are by design already compressed, so ZIP and other lossless compression algorithms won't be effective at reducing the size of these files any further. This means you'll get similar file sizes when setting c=0 vs. setting c=9 when archiving files such as JPGs.

Formats

Use the in and out parameters to specify the file archive format:

in=tar

Input file will be treated as a .tar archive when using m=extract.

in=tar.gz

Input file will be treated as a .tar.gz archive when using m=extract.

in=zip

Input file will be treated as a .zip archive when using m=extract.

out=tar

Output file will be saved as a .tar archive when using m=archive.

out=tar.gz

Output file will be saved as a .tar.gz archive when using m=archive.

out=zip

Output file will be saved as a .zip archive when using m=archive.

f=json

Generates a JSON index file to list the archive's contents when using m=extract.

f=text

Generates a text index file to list the archive's contents when using m=extract.

Paths

Only applicable to m=archive:

  • Use dest to specify the location to save the primary file to within the output archive.

  • Use file and file-dest to add additional files to the output archive.

dest=<string>

The destination path to save the primary file to in the resulting file archive.

Must include a "/" prefix.

file=<string>

Additional file to add to the resulting file archive.

You may specify this parameter multiple times.

To use: specify the "file path" attribute of another file as the query parameter's value.

file-dest=<string>

The destination path to save the additional file to in the resulting file archive.

You may specify this parameter multiple times: once per file parameter.

Must include a "/" prefix.

Requires: file

Was this section helpful? Yes No

You are using an outdated browser.

This website requires a modern web browser -- the latest versions of these browsers are supported: