Skip to main content

Reading Blobs

You can read blobs using HTTP GET requests and their blob ID or object ID.

Blob IDs

For example, the following cURL command reads a blob and writes it to an output file:

$ curl "$AGGREGATOR/v1/blobs/<some blob ID>" -o <some file name>

Alternatively, you can print the contents of a blob in the terminal with the cURL command:

$ curl "$AGGREGATOR/v1/blobs/<some blob ID>"
tip

Modern browsers attempt to sniff the content type for such resources, and generally do a good job of inferring content types for media. However, the aggregator on purpose prevents such sniffing from inferring dangerous executable types such as JavaScript or style sheet types.

Object ID

You can also read blobs by using the object ID of a Sui blob object or a shared blob. For example, the following cURL command downloads the blob corresponding to a Sui object ID:

$ curl "$AGGREGATOR/v1/blobs/by-object-id/<object-id>" -o <some file name>

Downloading blobs by object ID allows setting some HTTP headers. The aggregator recognizes the following attribute keys and returns the values in the corresponding HTTP headers when present:

  • content-disposition

  • content-encoding

  • content-language

  • content-location

  • content-type

  • link

Consistency checks

The consistency checks performed by the aggregator are the same as the ones performed by the CLI. For special use cases, the strict consistency check can be enabled by adding a query parameter strict_consistency_check=true (starting with v1.35). If the writer of the blob is known and trusted, you can disable the consistency check by adding a query parameter skip_consistency_check=true (starting with v1.36).