# Archives & binary tools

Archives and binary APIs inspect remote archives, retrieve a named entry, detect file types and compute file digests. An agent or script can use them to examine an archive listing, obtain a particular file, identify a payload from its bytes or verify an artifact against a published checksum. Each task requires fetching remote data through a hardened client; archive handling also requires readers and decompression-bomb controls.

archive-inspect takes a remote archive and returns entry paths, sizes, compression information and CRC values without extracting entries. archive-extract-file takes an archive and a named entry, then returns that entry as base64 bytes with a SHA-256 digest. Listing an archive reads declared sizes without inflating entries. Retrieving a named entry does not require unpacking the whole archive, and the entry is subject to size caps.

file-type-detect examines magic bytes and returns a canonical extension and media type. It does not base identification on the URL extension or the server content-type. remote-file-hash computes a digest of a remote file for checksum verification, fetching the whole remote file and buffering it in memory under a size cap. A listing supplies entry information without extracted bytes; the extraction member supplies bytes for the requested entry, while the hash member computes a digest of the remote file.

- Shelf: Media. Requires a heavy dependency.
- Default price: $0.003 per successful call
- Timeout ceiling: 94 s

## 4 APIs

| API | What it does | Price | Max input | Max duration | Timeout |
| --- | --- | --- | --- | --- | --- |
| [Archive Extract File API](https://grist.tools/docs/archive-extract-file) | Extracts one named entry from a remote zip, tar or tar.gz and returns its bytes (base64) with a sha256. | $0.003 | 25 MB | none | 90 s |
| [Archive Inspect API](https://grist.tools/docs/archive-inspect) | Lists the entries of a remote zip, tar or tar.gz (paths, sizes, compression and CRC) without extracting any of them. | $0.003 | 100 MB | none | 60 s |
| [File Type Detect API](https://grist.tools/docs/file-type-detect) | Detects a remote file's true type from its magic bytes, returning the canonical extension and media type. | $0.003 | 32 MB | none | 30 s |
| [Remote File Hash API](https://grist.tools/docs/remote-file-hash) | Computes the sha256, sha1 or md5 digest of a remote file, buffered in memory under a size cap, for checksum verification. | $0.003 | 100 MB | none | 60 s |

## Questions

### How do archive inspection and extraction differ?

archive-inspect lists paths, sizes, compression information and CRC values of an archive without extracting entries. archive-extract-file returns a named entry of an archive as base64 bytes with a SHA-256 digest.

### Does file-type-detect rely on the file extension?

No. It identifies the remote file from its magic bytes using a signature database and returns the canonical extension and media type.

### How does remote-file-hash read the remote file?

It computes a digest for checksum verification, with the algorithm chosen in the request. The whole remote file is fetched and buffered in memory under a size cap.

This page as HTML: https://grist.tools/tools/archives. Every page of grist.tools has a Markdown version at its address plus .md.
