resolveScheme

Resolves the scheme of a given URI and returns the corresponding URL. If the URI starts with "ipfs://", it constructs a URL using the IPFS client ID and the IPFS gateway. If the URI starts with "http", it returns the URI as is. Otherwise, it throws an error indicating an invalid URI scheme.

Example

import { resolveScheme } from "thirdweb/storage";
const url = resolveScheme({
client,
uri: "ipfs://Qm...",
});
function resolveScheme(options: ResolveSchemeOptions): string;

Parameters

The options object containing the URI and the IPFS client.

Type

let options: { client: ThirdwebClient; uri: string };

Returns

let returnType: string;

The resolved URL.