miroir de
				https://github.com/coolaj86/fizzbuzz.git
				synchronisé 2024-11-16 17:29:04 +00:00 
			
		
		
		
	put psuedo-code for streaming in comments
Cette révision appartient à :
		
							Parent
							
								
									86e3d5f76b
								
							
						
					
					
						révision
						566186f8ba
					
				@ -1,4 +1,4 @@
 | 
			
		||||
// TODO parse streaming
 | 
			
		||||
// TODO beef up AHR to allow streamed parsing
 | 
			
		||||
"use strict";
 | 
			
		||||
(function (undefined) {
 | 
			
		||||
  var fs = require('fs'),
 | 
			
		||||
@ -86,7 +86,7 @@
 | 
			
		||||
      stream,
 | 
			
		||||
      data = new Buffer('');
 | 
			
		||||
 | 
			
		||||
    stream = fs.createReadStream(file, { flags: 'r' });
 | 
			
		||||
    stream = fs.createReadStream(file, { flags: 'r', encoding: 'utf8' });
 | 
			
		||||
    stream.on('error', function (err) {
 | 
			
		||||
      promise.fulfill(err, stream, data);
 | 
			
		||||
    });
 | 
			
		||||
@ -150,6 +150,23 @@
 | 
			
		||||
    console.log("Average height of male dependent of brown-haired male Heads of Household: " + (heights / count));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  function parseChunk(chunk) {
 | 
			
		||||
    /*
 | 
			
		||||
    // TODO be more memory efficient
 | 
			
		||||
    // by seeking into the buffer
 | 
			
		||||
    data += chunk
 | 
			
		||||
    while (true) {
 | 
			
		||||
      index = data.indexOf('\n')
 | 
			
		||||
      if (-1 === index) {
 | 
			
		||||
        break;
 | 
			
		||||
      }
 | 
			
		||||
      line = data.substr(0, index);
 | 
			
		||||
      data = data.substr(index + 1);
 | 
			
		||||
      parseLine(line);
 | 
			
		||||
    }
 | 
			
		||||
    */
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  function parseData(err, x, data) {
 | 
			
		||||
    var lines = data.split('\n'),
 | 
			
		||||
      heads = [],
 | 
			
		||||
 | 
			
		||||
		Chargement…
	
	
			
			x
			
			
		
	
		Référencer dans un nouveau ticket
	
	Bloquer un utilisateur