Socket
Socket
Sign inDemoInstall

response-iterator

Package Overview
Dependencies
0
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

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


Version published
Maintainers
1
Install size
66.2 kB
Created

Readme

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

Last updated on 03 Jul 2022

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc