4

I'm using the Github API, which uses Link Headers, as defined here, for pagination.

Currently I'm just extracting 'next' URLs using some string manipulation but I was wondering if there was a proper module for this purpose (I haven't been able to find anything in 'npm search').

Thanks!

mikemaccana
  • 110,530
  • 99
  • 389
  • 494
  • 1
    I wrote https://github.com/wombleton/link-headers a while back — it has a terrible API, was written for a different spec, and it's not a module, but it's something. I'll see if I can turn it into a module and unsuck its API in the near future. – wombleton Mar 06 '13 at 11:42
  • @wombleton That would be awesome, thanks! – mikemaccana Mar 06 '13 at 15:55
  • [backbone-pageable](https://github.com/wyuenho/backbone-pageable/blob/master/lib/backbone-pageable.js) has a `parseLinks` function, which is used for parsing Github API Link headers. – balazs Jul 16 '13 at 21:33

1 Answers1

2

There's this: https://npmjs.org/package/parse-links

It looks a bit fragile, to my mind, but it looks like it will do very basic parsing.

wombleton
  • 8,336
  • 1
  • 28
  • 30