fetchFile method

Future<NBBufferResponse> fetchFile(
  1. String endpoint
)

Fetch and download a random file with its metadata (if available).

For more advanced options, you should use the Client.fetch() method and fetch the file yourself.

Implementation

Future<NBBufferResponse> fetchFile(String endpoint) async {
  final res = (await fetch(endpoint: endpoint))[0];
  final bytes = await request(res.url).then((value) => value.bodyBytes);
  return NBBufferResponse(bytes, res);
}