Skip to content

Instantly share code, notes, and snippets.

@Zubad
Zubad / nodejs_xlsx_stream_response.js
Created April 8, 2020 06:37
NodeJS: Send response as stream (XLSX File)
// https://stackoverflow.com/questions/61013208/how-to-write-xls-file-and-stream-to-response-in-node-js
const fs = require('fs');
const server = require('http').createServer();
const XLSX = require('xlsx');
server.on('request', (req, res) => {
const data = [
{id: '1', name: 'abc'},
{id: '2', name: 'xyz'}