UNPKG

req-fast

Version:

This module is designed to be the fast, lightweight way to fetch the web content(HTML stream).

17 lines (14 loc) 348 B
'use strict' var req = require('../') let buffers = [] let rs = req('http://httpbin.org/stream/10') rs.on('error', (err) => { console.log('[ERROR]', err.message) }) rs.on('data', (chunk) => { console.log('[INFO] chunk length:', chunk.length) buffers.push(chunk) }) rs.on('end', () => { console.log('[INFO] Response Buffers:', buffers) })