uploadFileWithSignedUrl()

Syntax

uploadFileWithSignedUrl(file: File, options: UploadFileWithSignedUrlOptions)

The method used to upload files in Eueno. We have two types to upload: encrypted and unencrypted.

Parameters

Type UploadFileOptions has the structure like this:

interface UploadFileWithSignedUrlOptions {
  uploadUrl: string;
  uploadTorrentUrl: string;
  exportedKey?: string; //Require if encrypt
}

Example

import {UploadFileWithSignedUrlOptions} from "@eueno/lib-browser";

const uploadFile = async () => {
   const file = files[0];
   const uploadUrl = "https://upload-service.eueno.io/upload?signature=eyJhbGciOiJSUzI1Ni..."
   const uploadTorrentUrl: "https://upload-service.eueno.io/upload?signature=eyJhbGciOiJSUzI1NiIsInR..."
   const exportedKey = "4R2Bw-kz9DnWA5FEcoopIsPhZZ5PswLBvtPwll6ejkU"
   const options = {
      uploadUrl,
      uploadTorrentUrl,
      exportedKey   
   }
   
   const response = await uploadFileWithSignedUrl(file, options);
    
    console.log(response);
 };

Response of example:

{
    data: {
        Hash: "QmQL923LcmRn6wSxgN7Yr6w2M2xBz8r4tpPxaatq3S45Z3",
        Name: "puz.png",
        Size: "51625",
    }
    status: 200
}

Last updated