2016-05-25 64 views
0

使用節點U 5.4.1錯誤:不落實嘗試創建ExcelJS

我想創建這樣的流的:

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

我不認爲你必須這樣做:

var rs = new stream.Readable(); 

試試看:

var workbook = new Excel.Workbook(); 
stream.pipe(workbook.xlsx.createInputStream()); 
相關問題