# Get file detail

On this page, we will show how to get file detail for both encrypted and unencrypted files.

To do that, we need 3 methods:

* [getDetailFile()](/eueno-libraries/eueno-lib-browser/get-file-detail/getdetailfile.md)
* [getDetailUnencryptedFile()](/eueno-libraries/eueno-lib-browser/get-file-detail/getdetailunencryptedfile.md)
* [getDetailEncryptedFile()](/eueno-libraries/eueno-lib-browser/get-file-detail/getdetailencryptedfile.md)

### Example

```javascript
import {
  getDetailFile,
  getDetailEncryptedFile,
  getDetailUnencryptedFile
} from "@eueno/lib-browser";
  
  const getFile = async (id, token) => {
    if (!id || !token) return;
    const fileDetail = await getDetailFile(id);
    if (!fileDetail) {
      console.error("File not found");
      return;
    }

    let bufferData;
    if (fileDetail.encryptKey) {
      bufferData = await getDetailEncryptedFile(
        fileDetail.torrentUrl,
        fileDetail.encryptKey,
        token,
        isShare ? true : false,
        [fileDetail.url, fileDetail.backupUrl],
        account,
        (torrent, remaining) => {
          dispatch(
            setTorrentInfo({
              download: torrent.downloadSpeed,
              upload: torrent.uploadSpeed,
              remain: remaining,
            })
          );
        }
      );
    } else {
      bufferData = await getDetailUnencryptedFile(
        token,
        fileDetail.torrentUrl,
        (torrent, remaining) => {
          dispatch(
            setTorrentInfo({
              download: torrent.downloadSpeed,
              upload: torrent.uploadSpeed,
              remain: remaining,
              peers: torrent.numPeers,
              progress: torrent.progress,
            })
          );
        }
      );
    }
    
    if (!bufferData) {
      console.error("Decrypt failed !");
      return;
    }

    //Render buffer data
    const output = document.getElementById("output");
    const filePreview = {
      name: fileDetail.name,
      createReadStream: function (opts) {
        if (!opts) opts = {};
        return From([
          bufferData?.slice(opts.start || 0, opts.end || bufferData.length),
        ]);
      },
    };
    if (output) {
      render.append(filePreview, output, function (err, elem) {
        if (err) {
          console.log(err);
          setMessage("This file preview is not supported!");
        }
      });
    }
  };
```


---

# 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.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.
