import { RequestBuilder } from "https://deno.land/x/dax@0.31.0/mod.ts";
Builder API for downloading files.
Methods
Fetches and gets the response as an array buffer.
Fetches and gets the response as a blob.
Fetches and gets the response.
Fetches and gets the response as form data.
Sets multiple headers at the same time via an object literal.
Sets a header to send with the request.
Fetches and gets the response as JSON additionally setting a JSON accept header if not set.
Do not throw if a non-2xx status code is received.
By default the request builder will throw when receiving a non-2xx status code. Specify this to have it not throw.
Do not throw if a non-2xx status code is received except for these excluded provided status codes.
This overload may be especially useful when wanting to ignore 404 status codes and have it return undefined instead. For example:
const data = await $.request(`https://crates.io/api/v1/crates/${crateName}`)
.noThrow(404)
.json<CratesIoMetadata | undefined>();
Note, use multiple arguments to ignore multiple status codes (ex. .noThrow(400, 404)
) as
multiple calls to .noThrow()
will overwrite the previous.
Pipes the response body through the provided transform.
Pipes the response body to the provided writable stream.
Pipes the response body to a file.
Pipes the response body to a file.
Shows a progress bar while downloading with the provided options.
Shows a progress bar while downloading.
Fetches and gets the response as text.