forked from sheetjs/sheetjs
		
	- node 4.x buffer fix (fixes #1150 h/t @gabyidong) - dependencies: CFB 1.0.8, codepage 1.14.0 - json object stream
		
			
				
	
	
	
		
			1.2 KiB
		
	
	
	
	
	
	
	
			
		
		
	
	
			1.2 KiB
		
	
	
	
	
	
	
	
Streaming Write
The streaming write functions are available in the XLSX.stream object.  They
take the same arguments as the normal write functions but return a Readable
Stream.  They are only exposed in NodeJS.
- XLSX.stream.to_csvis the streaming version of- XLSX.utils.sheet_to_csv.
- XLSX.stream.to_htmlis the streaming version of- XLSX.utils.sheet_to_html.
- XLSX.stream.to_jsonis the streaming version of- XLSX.utils.sheet_to_json.
nodejs convert to CSV and write file (click to show)
var output_file_name = "out.csv";
var stream = XLSX.stream.to_csv(worksheet);
stream.pipe(fs.createWriteStream(output_file_name));
nodejs write JSON stream to screen (click to show)
/* to_json returns an object-mode stream */
var stream = XLSX.stream.to_json(worksheet, {raw:true});
/* the following stream converts JS objects to text via JSON.stringify */
var conv = new Transform({writableObjectMode:true});
conv._transform = function(obj, e, cb){ cb(null, JSON.stringify(obj) + "\n"); };
stream.pipe(conv); conv.pipe(process.stdout);
https://github.com/sheetjs/sheetaki pipes write streams to nodejs response.