0

使用节点 v 5.4.1

我正在尝试像这样创建一个流:

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");
}

但我得到了错误Error: Not Implemented

我相信这是因为我没有实施,._read但我认为也许workbook.xlsx.createInputStream()会这样做。

我是否使用错误的流包?任何信息都会非常感谢

4

1 回答 1

0

我认为您不必这样做:

var rs = new stream.Readable();

试试看嘛:

var workbook = new Excel.Workbook();
stream.pipe(workbook.xlsx.createInputStream());
于 2016-10-26T12:54:17.077 回答