Files
Download Files

Download files

There are two methods to download files from the ROQ platform. The first method involves using API, while the second method involves downloading files directly from the ROQ Console. However, the latter method is restricted to the administrators or users who have access to the ROQ Console.

Using API

After you upload a file, you can access it using the file() API. If you need to list the uploaded files, use the files() method instead.

const filebyId =async () => {
	const myfile = await roqBrowserClient.roqPlatform.file({
		id: "dd1f3ac5-2951-460e-add3-d3ef9516d694",
		withCreatedByUser: true
	})
}

In JavaScript there are many ways to download files. For example, we can create a React component DownloadButton and make the href dynamic based on the fileData.

function DownloadButton({ fileData }) {
  return (
    <a href={fileData.file.url} download={fileData.file.name}>
      Download {fileData.file.name}
    </a>
  );
}

Using ROQ Console

You can also download files directly from the ROQ Console.

file in console