How to add pagination to this query

I have seen some blockstack apps with pagination of records. I was wondering how they did that. Lets assume that I have one thousands (1000) provision records in provision.json.

please how do I query

1.) The first 10 records only.

2.) How do I query from 20-30 records etc. below is the code.

some Blockstack Scholars like @Friedger - OpenIntents suggested that getFile is just a http request

My question now is?

Does it mean that If I have one thousand (1000) records of provisions, getFile http request will
fetch them all at once and there is no way to page them at blockstack end or any other means eg via reactjs way.

Again fetching the whole records at once might slow down the app performance.

Can someone give me an insight on what to do or better still a possible solution.

below is my reactjs query code. Thank You

const options = { decrypt: true }
      userSession.getFile('myprovision.json', options)
        .then((file) => {
          var provision = JSON.parse(file || '[]')
          this.setState({
            provIndex: provision.length,
            provision: provision
          })
        })
        .finally(() => {
       //ok
        })

Hi @martn,

There is no paging support for getFile()getFile() fetches the entire contents of the named file. However, it’s straightforward to implement paging – simply store batches of records as separate files (like myprovision-0-19.json, my-provision-20-39.json, my-provision-40-59.json, etc.), and store the number of pages in a special file like my-provision-page-count.json so you’ll know how many pages can be fetched. You’ll want to keep my-provision-page-count.json updated as you add more and more records.

You can also use Radiks, which I think supports paging.

Thank you Sir for the insight. I will try it out and get back to you @jude