web3.storage Open in urlscan Pro
2606:4700:4400::ac40:9b7b  Public Scan

Submitted URL: http://w3s.link/
Effective URL: https://web3.storage/docs/how-to/retrieve/
Submission: On December 02 via manual from GB — Scanned from GB

Form analysis 0 forms found in the DOM

Text Content

web3.storage/docsDocsDocs
CTRL K
GitHubGitHub (opens in a new tab)
CTRL K
 * Welcome
 * Quickstart
 * Command line
 * JS Client
 * Go Client
 * How to
    * Create an account
    * Create a space
    * Upload
    * Retrieve
    * List
    * Remove
    * Get Filecoin info
    * Publish IPNS names
    * Upload from CI
    * HTTP Bridge

 * Concepts
    * UCANs and web3.storage
    * Content-addressing
    * Upload vs. Store
    * Architecture options
    * Content Archive (CAR) files
    * Filecoin
    * Proof of Data Segment Inclusion (PoDSI)
    * IPFS Gateways

 * FAQ
 * Privacy Policy
 * Service level agreement
 * Terms of service
 * Specs (opens in a new tab)

System

On This Page

 * Using an IPFS HTTP gateway
 * Setting the filename
 * Using the ipfs command
 * Using curl
 * Next steps

Question? Give us feedback → (opens in a new tab)Edit this page

Docs
How to
Retrieve


HOW TO RETRIEVE DATA FROM WEB3.STORAGE

In this how-to guide, you'll learn several methods for retrieving data from
web3.storage.

All data stored using web3.storage is made available for retrieval via IPFS
(opens in a new tab), the InterPlanetary File System. IPFS is a distributed,
peer-to-peer network for storing and sharing content-addressed data. This guide
shows you several ways to retrieve your data from IPFS:

 * In your browser using an HTTP gateway.
 * Using the Saturn dCDN (opens in a new tab).
 * In your terminal using the IPFS command-line tools.
 * In your terminal using curl or Powershell.

When retrieving any data, you'll be using the content CID of the upload
(prefixed by bafy…).


USING AN IPFS HTTP GATEWAY

You can easily fetch any data stored using web3.storage using an IPFS HTTP
gateway. Because IPFS is a peer-to-peer, decentralized network, you can use any
public HTTP gateway to fetch your data. In this guide, we'll use the gateway at
w3s.link (which is optimized for data stored with web3.storage), but you can see
more worldwide gateways on the IPFS Public Gateway Checker (opens in a new tab).

You can use an IPFS gateway to view a list of all the files in that directory
from your browser. To do so, simply create a gateway URL. For example, if your
CID is bafybeidd2gyhagleh47qeg77xqndy2qy3yzn4vkxmk775bg2t5lpuy7pcu, you can make
a URL for the w3s.link gateway as follows:

https://bafybeidd2gyhagleh47qeg77xqndy2qy3yzn4vkxmk775bg2t5lpuy7pcu.ipfs.w3s.link/


💡

The w3s.link gateway has a rate limit of 200 requests per minute per IP.

If you want to link directly to a file within that directory, just add the file
path after the CID portion of the link. For example:
bafybeidd2gyhagleh47qeg77xqndy2qy3yzn4vkxmk775bg2t5lpuy7pcu.ipfs.w3s.link/not-distributed.jpg
(opens in a new tab) could be used as a shareable link for your new favorite
wallpaper.

💡

Your web3.storage console page includes IPFS gateway links to all the content
you've uploaded.


SETTING THE FILENAME

When downloading files from an HTTP gateway, web browsers will set the default
filename for the downloaded file based on the path component of the gateway
link. For example, if you use your browser's "Save link as..." feature on the
following link, it should prompt you to save a file named treehouse.jpeg:

https://bafybeicfnbaeigdtklwkrj35r4wtfppix732zromsadvgiu33mowah74yq.ipfs.w3s.link/treehouse.jpeg
(opens in a new tab)

In the link above, the CID
bafybeicfnbaeigdtklwkrj35r4wtfppix732zromsadvgiu33mowah74yq points to an IPFS
directory listing, which maps from the filename treehouse.jpeg to the CID for
the image itself.

Since the web3.storage client wraps your uploaded files in a directory by
default, this is the most common kind of gateway link you're likely to need, and
your users should get nice filenames when they download their content.

However, the behavior is a bit different if you make a gateway link directly to
the image CID:

 * https://bafkreifvallbyfxnedeseuvkkswt5u3hbdb2fexcygbyjqy5a5rzmhrzei.ipfs.w3s.link
   (opens in a new tab)
 * https://ipfs.io/ipfs/bafkreifvallbyfxnedeseuvkkswt5u3hbdb2fexcygbyjqy5a5rzmhrzei
   (opens in a new tab)

Both of the URLs above link directly to the CID of the image, without an
associated filename. The first URL uses the recommended "subdomain" URL format
for gateway links, while the second form uses a "path prefix" format that you
may see in use elsewhere in the IPFS ecosystem.

Depending on which style of link you use, your browser will prompt you to save a
file with a generic name like download, or with the CID as the filename.

If you have such a link, you can override the default filename by adding a query
string parameter to your link of the form ?filename=<desired-filename>. For
example, the following link will save as treehouse.jpeg, even though it links
directly to the image by CID:

https://bafkreifvallbyfxnedeseuvkkswt5u3hbdb2fexcygbyjqy5a5rzmhrzei.ipfs.w3s.link/?filename=treehouse.jpeg
(opens in a new tab)


USING THE IPFS COMMAND

If you have the IPFS command line interface (opens in a new tab) installed, you
can use it directly to fetch data without going through a gateway. This also
works if you've installed IPFS Desktop (opens in a new tab), which includes the
IPFS CLI.

To get the whole bundle and save it to a directory, run the following command:

ipfs get bafybeidd2gyhagleh47qeg77xqndy2qy3yzn4vkxmk775bg2t5lpuy7pcu



If you want to get a specific file out of the bundle, add its name onto the end
of the ipfs get bafybie... command:

ipfs get bafybeidd2gyhagleh47qeg77xqndy2qy3yzn4vkxmk775bg2t5lpuy7pcu/youareanonsense.jpg




USING CURL

Sometimes you may need to just download a specific file to your computer using
the command line.

 1. Open a terminal window.
 2. Use curl to download your file:

curl https://<YOUR_CID>.ipfs.w3s.link/<FILE_NAME> -o <OUTPUT_FILE>
 
# example
curl https://bafybeie2bjap32zi2yqh5jmpve5njwulnkualcbiszvwfu36jzjyqskceq.ipfs.w3s.link/example.txt -o ./output-file.txt



Replace <YOUR_CID>, <FILE_NAME>, and <OUTPUT_FILE> with their respective values.

VariableReplace withExample<YOUR_CID>The CID of the file you want to
download.bafybeie2bjap32zi2yqh5jmpve5n
jwulnkualcbiszvwfu36jzjyqskceq<FILE_NAME>The name of the file that you
originally uploaded to web3.storage.example.txt<OUTPUT_FILE>The path and
filename that you want curl to save the file to. This can be different to
<FILE_NAME>../output-file.txt


NEXT STEPS

Next, you'll learn about how to list uploaded content.


UploadList