downloadFile method

Future<Response> downloadFile(
  1. String filePath, {
  2. String? fileToken,
})

Downloads the file at the provided path.

The fileToken argument must be provided if the resource is protected by a storage function that checks the file's resource.Metadata.token (https://nhost.github.io/hasura-backend-plus/docs/storage-rules).

The file is returned as an HTTP response, populated with the headers.

Implementation

Future<http.Response> downloadFile(String filePath, {String? fileToken}) {
  return _apiClient.get<http.Response>(
    _objectPath(filePath),
    query: {
      if (fileToken != null) 'token': fileToken,
    },
    headers: _session.authenticationHeaders,
  );
}