{"id":13623928,"url":"https://github.com/thlorenz/parse-link-header","last_synced_at":"2025-05-15T17:01:23.439Z","repository":{"id":494506,"uuid":"10548134","full_name":"thlorenz/parse-link-header","owner":"thlorenz","description":"Parses a link header and returns paging information for each contained link.","archived":false,"fork":false,"pushed_at":"2023-02-09T19:41:22.000Z","size":20,"stargazers_count":301,"open_issues_count":7,"forks_count":27,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-31T20:11:26.186Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thlorenz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2013-06-07T11:01:54.000Z","updated_at":"2025-03-23T08:17:38.000Z","dependencies_parsed_at":"2022-08-16T10:25:25.678Z","dependency_job_id":"e4f74610-4262-4499-a304-4aac341d2f0c","html_url":"https://github.com/thlorenz/parse-link-header","commit_stats":{"total_commits":26,"total_committers":8,"mean_commits":3.25,"dds":0.3846153846153846,"last_synced_commit":"f380d3f99de4a5411b2d7f8da6069bb7529cbf4a"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thlorenz%2Fparse-link-header","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thlorenz%2Fparse-link-header/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thlorenz%2Fparse-link-header/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thlorenz%2Fparse-link-header/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thlorenz","download_url":"https://codeload.github.com/thlorenz/parse-link-header/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247730069,"owners_count":20986404,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T21:01:37.046Z","updated_at":"2025-04-07T21:15:36.781Z","avatar_url":"https://github.com/thlorenz.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# parse-link-header [![build status](https://secure.travis-ci.org/thlorenz/parse-link-header.png)](http://travis-ci.org/thlorenz/parse-link-header)\n\n[![testling badge](https://ci.testling.com/thlorenz/parse-link-header.png)](https://ci.testling.com/thlorenz/parse-link-header)\n\nParses a link header and returns paging information for each contained link.\n\n```js\nvar parse = require('parse-link-header');\n\nvar linkHeader =\n  '\u003chttps://api.github.com/user/9287/repos?page=3\u0026per_page=100\u003e; rel=\"next\", ' +\n  '\u003chttps://api.github.com/user/9287/repos?page=1\u0026per_page=100\u003e; rel=\"prev\"; pet=\"cat\", ' +\n  '\u003chttps://api.github.com/user/9287/repos?page=5\u0026per_page=100\u003e; rel=\"last\"'\n\nvar parsed = parse(linkHeader);\nconsole.log(parsed);\n```\n\n```js\n{ next:\n   { page: '3',\n     per_page: '100',\n     rel: 'next',\n     url: 'https://api.github.com/user/9287/repos?page=3\u0026per_page=100' },\n  prev:\n   { page: '1',\n     per_page: '100',\n     rel: 'prev',\n     pet: 'cat',\n     url: 'https://api.github.com/user/9287/repos?page=1\u0026per_page=100' },\n  last:\n   { page: '5',\n     per_page: '100',\n     rel: 'last',\n     url: 'https://api.github.com/user/9287/repos?page=5\u0026per_page=100' } }\n```\n\n## Installation\n\n    npm install parse-link-header\n\n## API\n\n***parseLinkHeader(linkHeader : String) : Object***\n\nParses the given link header containing [web links](http://tools.ietf.org/html/rfc5988) and returns an object keyed by\nthe `rel` property that contains information about each link.\n\n### Environmental Variables\n\nTo avoid redundantly parsing of extremely long (invalid) input, the package uses 2 env variables:\n\n`PARSE_LINK_HEADER_MAXLEN` - Sets the number of characters the input should be limited to - longer inputs will not be handled. Defaults to `2000`.\n\n`PARSE_LINK_HEADER_THROW_ON_MAXLEN_EXCEEDED` - Defines behavior for when the `PARSE_LINK_HEADER_MAXLEN` parameter is exceeded. If defined, an error will be thrown; if it's `null`, the function fails silently by returning `null`. Defaults to `null`.\n\n### Formatting a link header\n\nThe purpose of this module is to parse the link header information. To format an object generated by this module back to the link header string, use the [format-link-header](https://github.com/jonathansamines/format-link-header) module.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthlorenz%2Fparse-link-header","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthlorenz%2Fparse-link-header","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthlorenz%2Fparse-link-header/lists"}