Retrieving Content

This guide will walk you through retrieving content from the Lens Storage Nodes.


All uploaded contents are world-public readable. Privacy-settings will be implemented in the future.

Retrieving an entire file

Given a lens://af5225b… URI, you can resolve its content to a URL.

Use the resolve method of the StorageClient:

const url = await storageClient.resolve(uri);
console.log(url); // https://storage-api.testnet.lens.dev/af5225b6262e03be6bfacf31aa416ea5e00ebb05e802d0573222a92f8d0677f5

Retrieving Partial Content

The Storage Node API supports HTTP range requests to retrieve only partial contents of a file.

curl -H 'Content-Range: bytes=0-1023' \  'https://storage-api.testnet.lens.dev/af5225b6262e03be6bfacf31aa416ea5e00ebb05e802d0573222a92f8d0677f5'

This will only download the first 1024 bytes of a file.

For instance, if the file points to a video file, it's possible to use the link directly inside the <video> html tag:

<video width="640" height="480">  <source    src="https://storage-api.testnet.lens.dev/af5225b…"    type="video/mp4"  /></video>

When the slider of the video player is moved, the browser will send the right range requests to the Storage Node and the video will resume at that point without downloading the entire file.