Skip to content
This repository has been archived by the owner on Jun 1, 2021. It is now read-only.

how to limit the amount of messages #33

Closed
timaschew opened this issue Mar 30, 2017 · 2 comments
Closed

how to limit the amount of messages #33

timaschew opened this issue Mar 30, 2017 · 2 comments

Comments

@timaschew
Copy link

First of all thank you for this great library!

I wonder if and how it's possible to limit the amount of messages.
I've only seen to limit the messages for a specific time time, but I would like to show build some queries which provides the common pattern of offset and limit
For instance:

  • show last 10 message (offset: 0, limit: 10)
  • show previous 10 messages (offset: 10, limit: 10)
@chadxz
Copy link
Owner

chadxz commented Mar 31, 2017

In this library, you can pass searchOptions and fetchOptions to the search() method. These options objects are passed along to the underlying node-imap library's search and fetch methods, respectively. The search() method in this library combines these two underlying node-imap methods.

The author of node-imap has discussed how to implement a sort of limiting result set here, but it relies on being able to do the search and fetch as separate operations, only fetching a subset of the entire search result set.

Here are some things you could try:

  • fetch the entire list, then paginate through the results in your app.
  • make a change to this library to allow passing in a limit and offset to use for only fetching a portion of the whole search results.

@chadxz
Copy link
Owner

chadxz commented Oct 26, 2017

lmk if you need anything else.

@chadxz chadxz closed this as completed Oct 26, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants