# getDetailEncryptedFile()

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

### Syntax

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

### Params

<table><thead><tr><th width="128">Name</th><th width="96">Type</th><th width="100">Required</th><th>Description</th></tr></thead><tbody><tr><td>torrentUrl</td><td>string</td><td>Yes</td><td>Torren URL.</td></tr><tr><td>key</td><td>string</td><td>Yes</td><td>The encrypted key.</td></tr><tr><td>token</td><td>string</td><td>Yes</td><td>The authentication token.</td></tr><tr><td>isShare</td><td>boolean</td><td>Yes</td><td>If you get file detail of a file is shared, <code>isShare</code> will be <code>true</code>, else <code>isShare</code> will be <code>false.</code></td></tr><tr><td>webSeed</td><td>any</td><td>No</td><td>This is an array: [url, backupUrl]. If <code>isShare</code> is true, <code>webSeed</code> is required.</td></tr><tr><td>account</td><td>any</td><td>No</td><td>User Owallet address. If <code>isShare</code> is true, <code>account</code> is required.</td></tr><tr><td>onProcess</td><td>function</td><td>No</td><td><p>This function is used to handle the process get a file. </p><p>The first param <code>torrent</code> is an object that includes some torrent information (<a href="https://webtorrent.io/docs">see more</a>).</p><p>The second param <code>remaining</code> is the time remaining to get file.</p></td></tr></tbody></table>

### Example

```javascript
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

This method returns buffer data. You can use some library as "render-media" to render data ([see example](/eueno-libraries/eueno-lib-browser/get-file-detail/getdetailfile.md#example))


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.eueno.io/eueno-libraries/eueno-lib-browser/get-file-detail/getdetailencryptedfile.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
