exceljs: [BUG] Streaming I/O Workbook commit never resolve with Stream Passthrough

πŸ› Bug Report

Lib version: 4.3.2

Steps To Reproduce

import * as ExcelJS from 'exceljs'
import { Stream, PassThrough } from 'stream'
const stream = new Stream.Duplex.PassThrough({})
const wb = new ExcelJS.stream.xlsx.WorkbookWriter({
      stream: this.stream,
      useStyles: true,
      useSharedStrings: true
    })
const ws = wb.addWorksheet('XYZ');

ws.addRow({}).commit()
ws.commit()
await wb.commit()

The expected behaviour:

Promise be resolved

Possible solution (optional, but very helpful):

not sure why, any code example for this case? seems finish event not triggered so that commit can’t resolved. Background: I want to use Stream PassThrough as I can directly to upload the stream to S3 with sdk

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 1
  • Comments: 17 (1 by maintainers)

Most upvoted comments

@HyunTaek5 i solved problem with streams in this fork: https://www.npmjs.com/package/@zlooun/exceljs

@AnkitKadam567

It is important to put await before each commit

await worksheet.addRow(Object.keys(data)).commit();