pinata/react package which comes with a hook you can use to upload files and a convert helper function for converting CIDs into IPFS Gateway URLs.
Installation
Install the Pinata SDKUsage
Import at the top of your desired page or componentKeep in mind that states like
pause, resume, or progress are only available on files over 90 MiB that automatically engage resumable uploads through TUS.useUpload
upload method like so.
UploadOptions that can be passed into upload
uploadResponse will contain either the full upload response or just the CID if your file was over 90 MiB and utilized TUS resumable uploads.
If Pinata is still processing a large file when its last chunk arrives, the hook waits until the file is registered before setting uploadResponse, so loading stays true after every byte is sent. Pass waitForCid: false to skip that wait: uploadResponse is then the CID Pinata sent with the last chunk, or null if it wasn’t available yet, and registration can still fail afterwards.
The convert helper can be used to turn a CID into a URL like so:
useUpload hook with progress and abilities to pause and resume the upload.