Skip to main content

IPFS

validateIpfsUrl

validateIpfsUrl(url, ipfsGateway?): string

Returns a valid URL. If it is an IPFS URL (E.g. ipfs://{hash}), the IPFS Gateway will be used to generate a valid link. Otherwise the link is returned.

Parameters

NameTypeDescription
urlstringThe URL that is to be validated.
ipfsGateway?stringThe IPFS Gateway to be used for IPFS URLs.

Returns

string

Since

v0.0.1

Example

validateIpfsUrl('ipfs://{hash}') => 'https://2eff.lukso.dev/ipfs/{hash}'
validateIpfsUrl('https://google.com/something') => 'https://google.com/something'
validateIpfsUrl('') => ''

Defined in

IPFS/validateIpfsUrl/validateIpfsUrl.ts:17