The reading of a file by the ranges of its bytes that a reader needs, fetched in rounds within limits, for the readers of views.
A reader of a view gives the ranges that it lacks, and read! fetches them and reads again, until the reader has what it needs. The bytes come from a fetch function: an http/fetcher for a file on the web, or a fetcher of a local file or a Blob.
The reading of a file by the ranges of its bytes that a reader needs, fetched in rounds within limits, for the readers of views. A reader of a view gives the ranges that it lacks, and read! fetches them and reads again, until the reader has what it needs. The bytes come from a fetch function: an http/fetcher for a file on the web, or a fetcher of a local file or a Blob.
(blob-fetcher blob)A function that fetches the bytes of the Blob blob by range, as read!
takes it, e.g. a File that the listener picked, as the :fetch of
format.media/read!.
A function that fetches the bytes of the Blob `blob` by range, as read! takes it, e.g. a File that the listener picked, as the :fetch of format.media/read!.
The limits of a reading by ranges that its options don't set.
One reading fetches :max-bytes of a file at most, 32 MB, and starts no request after :max-seconds. Nil sets no limit of bytes or of time. It fetches in :max-rounds rounds, of :max-requests requests each. The ranges that a reading needs beyond them come in the rounds after.
The sizes in a file are numbers that its writer chose, so a file can ask a reader for more than it holds.
The limits of a reading by ranges that its options don't set. One reading fetches :max-bytes of a file at most, 32 MB, and starts no request after :max-seconds. Nil sets no limit of bytes or of time. It fetches in :max-rounds rounds, of :max-requests requests each. The ranges that a reading needs beyond them come in the rounds after. The sizes in a file are numbers that its writer chose, so a file can ask a reader for more than it holds.
(file-fetcher f)A function that fetches the bytes of the local file f, a path or a
java.io.File, by range, as read! takes it, e.g. as the :fetch of
format.media/read! for a downloaded episode.
A function that fetches the bytes of the local file `f`, a path or a java.io.File, by range, as read! takes it, e.g. as the :fetch of format.media/read! for a downloaded episode.
(read! fetch read)(read! fetch read opts)Read the file whose bytes fetch gets with the reader read, within
the limits of opts. On the JVM it gives what the reader gives, and in
ClojureScript a promise of it.
The read function takes a view. It gives its result, or the ranges
that it needs under :need, as pairs of a start and an end. The fetch
function takes a start and an end, end excluded. It gives a map of the
:bytes, :start and :total, or a future or a promise of one. Its answer
is :whole? when it holds the file from its start, whatever start was
asked. A server that ignores ranges gives such an answer.
The ranges that one reading needs come in one round, in 16 requests at most, one after another. Each request asks for 64 KB or more, and ranges near each other come in one request.
The opts give the limits, with default-limits for the limits that
they don't set, and :now-fn, a function that gives the time, the clock by
default. When a limit stops the reading, or when the ranges didn't
come, the result is an empty map, and its report has :file/incomplete.
A reading fetches nothing of ranges that hold more bytes than it can
still fetch.
Nothing that fetch does throws. When fetch fails, the result has a
:file/unreachable diagnostic under :error.
Read the file whose bytes `fetch` gets with the reader `read`, within the limits of `opts`. On the JVM it gives what the reader gives, and in ClojureScript a promise of it. The `read` function takes a view. It gives its result, or the ranges that it needs under :need, as pairs of a start and an end. The `fetch` function takes a start and an end, end excluded. It gives a map of the :bytes, :start and :total, or a future or a promise of one. Its answer is :whole? when it holds the file from its start, whatever start was asked. A server that ignores ranges gives such an answer. The ranges that one reading needs come in one round, in 16 requests at most, one after another. Each request asks for 64 KB or more, and ranges near each other come in one request. The `opts` give the limits, with default-limits for the limits that they don't set, and :now-fn, a function that gives the time, the clock by default. When a limit stops the reading, or when the ranges didn't come, the result is an empty map, and its report has :file/incomplete. A reading fetches nothing of ranges that hold more bytes than it can still fetch. Nothing that `fetch` does throws. When `fetch` fails, the result has a :file/unreachable diagnostic under :error.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |