Show HN: Fetch API compatible, complex form data / JSON body parser and guard (github.com)
We've been working on open sourcing our streaming complex body parser/guard and wouldn't mind some more people contributing. It features:
- JSON, urlencoded AND multipart form data parsing
- Out-of-the-box constraints for resulting object depth, key amount and size; definable globally and per call, preventing resource exhaustion by bailing on the stream if limits are exceeded
- Multi-boundary (!) multipart form data parsing
- Multidimensional array form data with auto-increment and explicit indexes (formElement[] vs formElement[0])
- Object form data with dot notation, including arbitrary amounts of nesting with arrays (<input name="foo.bar[].baz" value="it works!" />)
- Typed output for the resulting object if you use a (user-specified) validator like Zod
- Optional automatic casting for numbers and booleans in form data
It's originally done for SvelteKit projects, but nothing's stopping you from using it in Hono, Next, etc. Thanks!
0 comments
[ 2.7 ms ] story [ 9.2 ms ] threadNo comments yet.