Eueno
  • EUENO – Decentralized Encrypting Blockchain Oracles for Web3
    • Litepaper
    • Use Cases
  • Get Started
    • Prerequisites
    • Buckets
      • Create a bucket
      • Delete a bucket
    • Files
      • Upload a file
      • View a file
      • Delete a file
      • Share a file
  • Pricing
  • Eueno libraries
    • @eueno/lib-browser
      • Installation
      • Setup
      • Create key (generate a key for encrypting the file(s))
      • login()
      • useEuenoContext()
      • getUserInfo()
      • updateUserInfo()
      • createProject()
      • getProjectInfo()
      • getProjects()
      • getFilesListByFolder()
      • deleteProject()
      • createFolder()
      • uploadFolder()
      • Get folder detail
      • deleteFolder()
      • uploadFile()
      • uploadFileWithSignedUrl()
      • getCid()
      • getFileById()
      • getFileListById()
      • Get file detail
        • getDetailFile()
        • getDetailUnencryptedFile()
        • getDetailEncryptedFile()
      • getDetailMultiEncryptedFiles()
      • deleteFile()
      • shareFile()
      • shareMultiFile()
      • deleteSharePermission()
      • getShareList()
      • getShareListToMe ()
    • @eueno/lib-node
      • Create eueno client
      • Create project key
      • Create project
      • Upload file
      • Upload folder
      • Get file
      • Get list file
      • Share file
      • Get shared files
      • Create folder
      • Create Account
      • Decrypt Get Key Aes
      • Decrypt File by Key Aes
  • Policies
    • Privacy Policy
    • Terms of Service
Powered by GitBook
On this page
  • Syntax
  • Params
  • Example
  • Response
  1. Eueno libraries
  2. @eueno/lib-browser
  3. Get file detail

getDetailEncryptedFile()

This method is used to get detail of an encrypted file.

Syntax

getDetailEncryptedFile: (
    torrentUrl: any, 
    key: string, 
    token: string, 
    isShare: boolean, 
    webSeed?: any, 
    account?: any, 
    onProcess?: (torrent: any, remaining: any) => void
)

Params

Name
Type
Required
Description

torrentUrl

string

Yes

Torren URL.

key

string

Yes

The encrypted key.

token

string

Yes

The authentication token.

isShare

boolean

Yes

If you get file detail of a file is shared, isShare will be true, else isShare will be false.

webSeed

any

No

This is an array: [url, backupUrl]. If isShare is true, webSeed is required.

account

any

No

User Owallet address. If isShare is true, account is required.

onProcess

function

No

This function is used to handle the process get a file.

The second param remaining is the time remaining to get file.

Example

import { getDetailFile, getDetailEncryptedFile } from "@eueno/lib-browser";
import { useDispatch, useSelector } from "react-redux";

const dispatch = useDispatch();
const getFile = async (id, token) => {
 try {
  const fileDetail = await getDetailFile(id);
    if (!fileDetail) {
      return console.error("File not found");
    }

    let bufferData;
 
    if (fileDetail.encryptKey) {
        bufferData = await getDetailEncryptedFile(
        fileDetail.torrentUrl,
        fileDetail.encryptKey,
        token,
        isShare: false,
        [fileDetail.url, fileDetail.backupUrl],
        account,
        (torrent, remaining) => {
          dispatch(
            setTorrentInfo({
              download: torrent.downloadSpeed,
              upload: torrent.uploadSpeed,
              remain: remaining,
            })
          );
        }
      );
    }
    
 } catch (error) {
   console.log(error);
 }
};

Response

PreviousgetDetailUnencryptedFile()NextgetDetailMultiEncryptedFiles()

Last updated 1 year ago

The first param torrent is an object that includes some torrent information ().

This method returns buffer data. You can use some library as "render-media" to render data ()

see more
see example