0

Using Node v 5.4.1

I'm trying to create a stream like so:

const program = require('commander'),
      Excel   = require('exceljs'),
      colors  = require('colors/safe'),
      inquirer  = require('inquirer'),
      async    = require('async'),
      stream   = require('stream');

program
  .version('0.0.1')
  .usage('[options] <file>')
  .parse(process.argv);

if (program.args.length > 0 && program.args[0]) {
  var workbook = new Excel.Workbook();
  var rs       = new stream.Readable();
  rs.pipe(workbook.xlsx.createInputStream()); < -- Error

} else {
  console.log("You did not enter a valid file path");
}

But I get the error Error: Not Implemented

which I believe is because I have not implemented the ._read but I thought maybe workbook.xlsx.createInputStream() would do this.

Am I using the stream package wrong? Any information would be great thanks

Datsik
  • 14,453
  • 14
  • 80
  • 121

1 Answers1

0

I don't think you have to do this:

var rs = new stream.Readable();

Just try:

var workbook = new Excel.Workbook();
stream.pipe(workbook.xlsx.createInputStream());