Skip to content
On this page

Function: readPages()

TypeScript
function readPages(
   query: PageQuery, 
   filter: Filter, 
bounds?: PageBounds): Promise<PagedRead>;

Defined in: pages.ts:112 (opens in a new tab)

Reads filter to its end on every relay query asks, paging with until (inclusive; events already read are skipped). Relays answer newest first up to a cap of their own, which can sit below limit. A relay's read ends on a page that is empty, under MIN_PAGE (or limit), or shorter than a page it sent before. Each page asks at the oldest second a relay still open sent, so no relay skips what it holds; when relays hold different events, one probe of the seconds above the page's oldest tells which of them sent only there. A page that sits wholly at one second cannot be paged past by until: the read steps to the second before (first asking at that second when the page held events the reader drops, whose seconds it cannot see). A relay that then sends anything sent a full page of its own at that second and may hold more there, so its read is cut off. One that sends nothing is complete only if it sends more than that in a page, which one REQ for the filter's kinds alone tells. A relay that misses a page stopped, and stays stopped: cut off if it sent anything, else no answer. Past a bound, a relay still open is cut off. A relay is taken to send at least MIN_PAGE a page; one that caps below it without declaring so in NIP-11 is not told apart.

ParametersLink to this section

ParameterType
queryPageQuery
filterFilter
boundsPageBounds

ReturnsLink to this section

Promise<PagedRead>