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

response-iterator

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

response-iterator

Creates an async iterator for a variety of inputs in the browser and node. Supports fetch, node-fetch, and cross-fetch

  • 0.2.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.3M
decreased by-11.84%
Maintainers
1
Weekly downloads
 
Created
Source

response-iterator

Creates an async iterator for a variety of inputs in the browser and node. Supports fetch, node-fetch, cross-fetch, axios, got, undici.

Example 1

// import "isomorphic-fetch"; // node only
import responseIterator from 'response-iterator';

const res = await fetch('https://raw.githubusercontent.com/kmalakoff/response-iterator/master/package.json');

let data = '';
for await (const chunk of responseIterator(res)) {
  data += chunk;
}
console.log(JSON.parse(data).name); // "response-iterator"

Example 2

import crossFetch from 'cross-fetch';
import responseIterator from 'response-iterator';

const res = await crossFetch('https://raw.githubusercontent.com/kmalakoff/response-iterator/master/package.json');

let data = '';
for await (const chunk of responseIterator(res)) {
  data += chunk;
}
console.log(JSON.parse(data).name); // "response-iterator"

Documentation

API Docs

Keywords

FAQs

Package last updated on 03 Jul 2022

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