使用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()
可能会这样做。
我使用的流包是错误的吗?任何信息都会很棒,谢谢
答案 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();