{"id":15704188,"url":"https://github.com/kikobeats/http-body","last_synced_at":"2025-05-07T13:46:22.978Z","repository":{"id":65416420,"uuid":"591938586","full_name":"Kikobeats/http-body","owner":"Kikobeats","description":"Parse the stream body into text/json/buffer/urlencoded (437 bytes).","archived":false,"fork":false,"pushed_at":"2024-12-16T18:48:55.000Z","size":57,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-29T01:50:50.069Z","etag":null,"topics":["body-parser","nodejs"],"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/Kikobeats.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-22T12:19:31.000Z","updated_at":"2024-12-16T18:48:59.000Z","dependencies_parsed_at":"2024-10-24T06:16:26.651Z","dependency_job_id":"72d9e29a-0764-4e5b-8121-0b8ae0a6efd0","html_url":"https://github.com/Kikobeats/http-body","commit_stats":{"total_commits":39,"total_committers":2,"mean_commits":19.5,"dds":"0.10256410256410253","last_synced_commit":"d9b79f37c532a12581f42541acf3403ace1565d8"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kikobeats%2Fhttp-body","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kikobeats%2Fhttp-body/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kikobeats%2Fhttp-body/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kikobeats%2Fhttp-body/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kikobeats","download_url":"https://codeload.github.com/Kikobeats/http-body/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252890049,"owners_count":21820297,"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":["body-parser","nodejs"],"created_at":"2024-10-03T20:10:39.391Z","updated_at":"2025-05-07T13:46:22.958Z","avatar_url":"https://github.com/Kikobeats.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# http-body\n\n![Last version](https://img.shields.io/github/tag/Kikobeats/http-body.svg?style=flat-square)\n[![Coverage Status](https://img.shields.io/coveralls/Kikobeats/http-body.svg?style=flat-square)](https://coveralls.io/github/Kikobeats/http-body)\n[![NPM Status](https://img.shields.io/npm/dm/http-body.svg?style=flat-square)](https://www.npmjs.org/package/http-body)\n\n\u003e Parse the stream body into text/json/buffer/urlencoded (437 bytes).\n\n## Install\n\n```bash\n$ npm install http-body --save\n```\n\n## Usage\n\n```js\nconst { buffer, text, json, urlencoded } = require('http-body')\n\n/* into buffer */\nawait buffer(req)\n// =\u003e \u003cBuffer 7b 22 70 72 69 63 65 22 3a 20 39 2e 39 39 7d\u003e\n\n/* into text */\nawait text(req)\n// =\u003e '{\"price\": 9.99}'\n\n/* into json */\nawait json(req)\n// =\u003e { price: '9.99' }\n\n/* into URLSearchParams */\nawait urlencoded(req)\n// =\u003e 'price=9.99'\n```\n\nThe max body size allowed by default is 1 MB. That can be customize as second argument:\n\n```js\nconst { buffer, text, json, urlencoded } = require('http-body')\nconst bytes = require('bytes')\n\nawait buffer(req, { limit: bytes('1mb')})\n// =\u003e TypeError: body size (1112140) is over the limit (1048576)\n```\n\n## API\n\n### text(req, options)\n\nConverts request body to string.\n\n### urlencoded(req, options)\n\nParses request body using `new URLSearchParams`.\n\n### json(req, options)\n\nParses request body using `JSON.parse`.\n\n### buffer(req, options)\n\nMinimal body parsing without any formatting.\n\n## Options\n\n### limit\n\nType: `number`\u003cbr\u003e\nDefault: `1048576`\n\nThe max body size allowed.\n\nIf the request body exceeds it, it throws an error.\n\n## License\n\n**http-body** © [Kiko Beats](https://kikobeats.com), released under the [MIT](https://github.com/Kikobeats/http-body/blob/master/LICENSE.md) License.\u003cbr\u003e\nAuthored and maintained by [Kiko Beats](https://kikobeats.com) with help from [contributors](https://github.com/Kikobeats/http-body/contributors).\n\n\u003e [kikobeats.com](https://kikobeats.com) · GitHub [Kiko Beats](https://github.com/Kikobeats) · X [@Kikobeats](https://x.com/Kikobeats)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkikobeats%2Fhttp-body","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkikobeats%2Fhttp-body","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkikobeats%2Fhttp-body/lists"}