Skip to main content

Upload file to Arcana Store

In this tutorial you will learn how to use Arcana Storage SDK and upload a file to the distributed Arcana Store.

Prerequisites

  • Make sure your dApp is integrated with Arcana Storage SDK.
  • All prerequisites for integrating with Storage SDK must be met
  • The code in the steps section refers to StorageProvider object initialized during Storage SDK integration:
import { StorageProvider } from '@arcana/storage/dist/standalone/storage.umd';

dAppStorageProvider = new StorageProvider({
appId: ARCANA_APP_ID,
provider: window.ethereum,
email: user_email_string,
});

Steps

At a high level, uploading the file is a two step process that involves obtaining an Uploader from the Storage SDK and calling the upload function with the specified file. Make sure you save the DID assigned to the uploaded file for future use. You will require it to perform any file access modification operation or to delete the file.

Step 1: Get the Uploader

const Uploader = dAppStorageProvider.getUploader();

Step 2: Call upload function

// file: Blob format
Uploader.upload(file);

What's Next?

You can verify that the file you uploaded exists on the Arcana Store by obtaining storage metrics and listing all the files that the current logged in user has uploaded.

If you are using Storage SDK with a third party wallet, you can also consider integrating with Arcana Auth SDK to ensure the privacy of your data by encrypting data before uploading and decrypting data after download.

See also