{"repo":"maraisr/meros","free":true,"listed":false,"github":"https://github.com/maraisr/meros","clone":"git clone https://github.com/maraisr/meros.git","description":"🪢 A fast utility that makes reading multipart responses simple","language":"TypeScript","stars":203,"topics":["fetch","multipart","multipart-mixed","streaming-data","defer","stream","graphql","relay"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"A utility that makes reading multipart responses simple This is free to use software, but if you do like it, consider supporting me ❤️ ⚡ Features - No dependencies - Seamless api - Super performant - Supports any [^1] content-type - preamble and epilogue don't yield - Browser/Node Compatible - Plugs into existing libraries like Relay and rxjs [^1]: By default, we'll look for JSON, and parse that for you. If not, we'll give you the body as what was streamed. 🚀 Usage Visit /examples for more info! Specific Environment Browser Node 🔎 API Meros offers two flavours, both for the browser and for node; but their api's are fundamentally the same. Note : The type Response is used loosely here and simply alludes to Node's IncomingMessage or the browser's Response type. meros(response: Response, options?: Options) Returns: Promise Meros returns a promise that will resolve to an AsyncGenerator if the response is of multipart/mixed mime, or simply returns the Response if something else; helpful for middlewares. The idea here being that you run meros as a chain off fetch. If the content-type is NOT a multipart, then meros will resolve with the response argument. Example on how to handle this case each Part gives you access to: - json: boolean Tells you the body would be a JavaScript object of your defined generic T . - headers: object A key-value pair of all headers discovered from this part. - body: T Fallback Is the body of the part, either as a JavaScript object (noted by json ) or th","default_branch":null,"files":null,"tree":[],"storefront":"/r/maraisr","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/maraisr/meros/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}