# 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](https://docs.eueno.io/eueno-libraries/eueno-lib-browser/getdetailfile#example))
