错误:未实现尝试使用ExcelJS创建流

时间:2016-05-25 01:57:34

标签: node.js exceljs

使用Node 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()可能会这样做。

我使用的流包是错误的吗?任何信息都会很棒,谢谢

1 个答案:

答案 0 :(得分:0)

我认为你不必这样做:

$newCategory = array( $list[0] , $list[$key]); 
foreach($newproducts as $prod)
{
$prod->setCategoryIds(
        array_merge($prod->getCategoryIds(), $newCategory)
     );
$prod->save();
}

试试吧:

var rs = new stream.Readable();