🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.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 642B utility that makes reading multipart responses simple

1.3.0
latest
Source
npm
Version published
Weekly downloads
3M
-11.72%
Maintainers
1
Weekly downloads
 
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

defer

FAQs

Package last updated on 26 May 2023

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