js icon indicating copy to clipboard operation
js copied to clipboard

Detect protocol when downloading assets

Open lorisleiva opened this issue 3 years ago • 1 comments

Not super urgent but we'll eventually need an extendable way to download assets that are not simply using the http(s) protocols. For instance, someone could pass in an ipfs:// URI and the SDK would need to know how to resolve it.

Having a method such as addProtocolResolver(protocol, callback) could be part of the solution.

Currently, the abstract StorageDriver deals with downloading since it enforces an upload method and it makes sense to have them together semantically.

One solution could be to add this logic to the abstract StorageDriver so all drivers inherit from this logic. However, it might be cleaner to separate the upload and download logic since the latter is independent of the storage provider. The StorageDriver could become the UploadDriver and we'd have another driver type called DownloadDriver. These are just raw ideas I have in mind, nothing set in stone.

lorisleiva avatar Mar 22 '22 16:03 lorisleiva

+1 for this

currently storing IPFS URIs on chain as the raw protocol link so that clients can decide which gateway to use, and would be nice to utilize the new loadJsonMetadata feature with them in conjunction with an asset URI resolver.

callensm avatar Oct 04 '22 15:10 callensm