{"id":15393025,"url":"https://github.com/shgysk8zer0/netlify-func-utils","last_synced_at":"2026-03-05T08:31:10.387Z","repository":{"id":197288709,"uuid":"691306626","full_name":"shgysk8zer0/netlify-func-utils","owner":"shgysk8zer0","description":"A collection of  helpful functions for  building Netlify Functions","archived":false,"fork":false,"pushed_at":"2026-02-26T22:59:08.000Z","size":9309,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-27T05:00:08.200Z","etag":null,"topics":["aws-lambda","form-data","netlify","netlify-functions"],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/@shgysk8zer0/netlify-func-utils","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/shgysk8zer0.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"shgysk8zer0","liberapay":"shgysk8zer0"}},"created_at":"2023-09-13T23:14:12.000Z","updated_at":"2026-02-26T22:33:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"75307f20-7371-45fe-b3e6-dd083d9f6e7d","html_url":"https://github.com/shgysk8zer0/netlify-func-utils","commit_stats":{"total_commits":112,"total_committers":2,"mean_commits":56.0,"dds":0.0982142857142857,"last_synced_commit":"ccd53c6885cf3076d1de41f4b54bc2c7de9f33a8"},"previous_names":["shgysk8zer0/netlify-func-utils"],"tags_count":5,"template":false,"template_full_name":"shgysk8zer0/npm-template","purl":"pkg:github/shgysk8zer0/netlify-func-utils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shgysk8zer0%2Fnetlify-func-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shgysk8zer0%2Fnetlify-func-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shgysk8zer0%2Fnetlify-func-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shgysk8zer0%2Fnetlify-func-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shgysk8zer0","download_url":"https://codeload.github.com/shgysk8zer0/netlify-func-utils/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shgysk8zer0%2Fnetlify-func-utils/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29976272,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T16:35:47.903Z","status":"ssl_error","status_checked_at":"2026-03-01T16:35:44.899Z","response_time":124,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["aws-lambda","form-data","netlify","netlify-functions"],"created_at":"2024-10-01T15:17:20.075Z","updated_at":"2026-03-05T08:31:10.145Z","avatar_url":"https://github.com/shgysk8zer0.png","language":"JavaScript","funding_links":["https://github.com/sponsors/shgysk8zer0","https://liberapay.com/shgysk8zer0"],"categories":[],"sub_categories":[],"readme":"# @shgysk8zer0/netlify-func-utils\n A collection of helpful functions for building Netlify Functions\n\n\u003e [!IMPORTANT]\n\u003e This package relies on `FormData` and `File` support, which was added in Node 20\n\u003e and will be available on Netlify and AWS Lambda sometime after it reaches LTS\n\u003e on or about 2023-10-24. In Node 18, `FormData` is supported, but uploads will\nbe `Blob`s instead of `File`s.\n\n## Features\n- Custom `NetlifyRequest` class extending `Request`\n  - Created from a `HandlerEvent` event\n  - Adds convenient `searchParams` property (`URLSearchParams`)\n  - Adds `cookies` property as a `Map` from the `Cookie` header\n- A `createHandler` function\n  - Accepts an object of HTTP Methods and callbacks\n  - Automatically handles errors\n  - Callbacks are passed a `NetlifyRequest` object and must return a `Response`\n  - Automatically adds CORS headers (can be disabled)\n  \n## Example\n\n```js\nimport { createHandler } from '@shgysk8zer0/netlify-func-utils`;\nimport { BAD_REQUEST, NOT_AUTHORIZED } from '@shgysk8zer0/http/status';\nimport { HttpError } from '@shgysk8zer0/http/error';\n\nexport const handler  = createHandler({\n  get: async req =\u003e {\n    if (req.searchParams.has('id')) {\n      return Response.json(await getItem(req.searchParams.get('id)));\n    }\n  },\n  post: async req = {\n    if (! req.cookies.has('token')) {\n      throw new HTTPError('You must be signed-in.', { status: NOT_AUTHORIZED });\n    } else {\n      const data = await req.formData(); // `FormData`, including `File` objects\n      \n      if (! data.has('required-field')) {\n        throw new HTTPError('Missing requied field.', { status: BAD_REQUEST });\n      } else {\n        // Maybe save something to a DB.\n        return Response.json({ created: item.id });\n      }\n    }\n  },\n  delete: async req =\u003e {\n    //\n  },\n}, {\n  cors: true,\n  headers: new Headers({ 'X-UID': crypto.randomUUID() }),\n  allowHeaders: ['X-Foo', 'X-UID'],\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshgysk8zer0%2Fnetlify-func-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshgysk8zer0%2Fnetlify-func-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshgysk8zer0%2Fnetlify-func-utils/lists"}