Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

meros

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

meros

A fast 626B utility that makes reading multipart responses simple

  • 1.2.0-next.4
  • next
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is meros?

The meros npm package is designed to handle multipart responses in a more convenient and efficient way. It is particularly useful for dealing with GraphQL multipart responses, allowing clients to process parts of the response as they arrive, rather than waiting for the entire response. This can improve performance and user experience in applications that consume streaming APIs or need to handle large, multipart responses.

What are meros's main functionalities?

Parsing GraphQL multipart responses

This code sample demonstrates how to use meros to parse a GraphQL multipart response from a fetch request. It checks if the response is of type 'multipart/mixed' and then uses meros to asynchronously iterate over each part of the response, logging the body of each part if it is JSON.

import { meros } from 'meros';

const response = await fetch('/graphql', {
  body: JSON.stringify({ query }),
  method: 'POST',
});

if (response.headers.get('content-type').includes('multipart/mixed')) {
  const parts = await meros(response);
  for await (const part of parts) {
    if (part.json) {
      console.log(part.body);
    }
  }
}

Other packages similar to meros

Keywords

FAQs

Package last updated on 24 Dec 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc