Skip to content

Instantly share code, notes, and snippets.

Created July 25, 2019 13:19
What would you like to do?
read data to stream
import http from 'http';
import axios from 'axios';
http.createServer(async function (req, res) {
const responseStream = await axios({
method: 'get',
url: '',
responseType: 'stream'
const contentType = responseStream.headers['content-type'];
const contentLength = responseStream.headers['content-length'];
res.writeHead(200, {
'Content-Type': contentType,
'Content-Length': contentLength
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment