var CharsetMatch = require("./build/Release/node-icu-charset-detector").CharsetMatch;

function detectCharset(buffer, options) {
  var charsetMatch = new CharsetMatch(buffer);

  if (charsetMatch.getName() === null) {
    return null;
  }

  var charset = new String(charsetMatch.getName());
  charset.language = charsetMatch.getLanguage();
  charset.confidence = charsetMatch.getConfidence();

  return charset;
}

exports.detectCharset = detectCharset;
exports.CharsetMatch = CharsetMatch;

@@ -413,45 +413,672 @@
 %0A%7D%0A%0A
-exports.detectCharset = detectCharset
+function detectCharsetStream(stream, onDetectionFinish) %7B%0A  var buffer = null;%0A  var finished = false;%0A%0A  function onChunkArrives(chunk) %7B%0A    buffer = buffer ? Buffer.concat(buffer, chunk) : chunk;%0A%0A    var charset = detectCharset(buffer);%0A    if (charset !== null) %7B%0A      // detection succeed. stop reading chunks.%0A      stream.removeListener(%22data%22, onChunkArrives);%0A      finished = true;%0A      onDetectionFinish(charset);%0A    %7D%0A  %7D%0A%0A  stream.on(%22data%22, onChunkArrives);%0A  stream.on(%22end%22, function () %7B%0A    if (!finished) %7B%0A      onDetectionFinish(null);%0A    %7D%0A  %7D);%0A%7D%0A%0Aexports.detectCharset = detectCharset;%0Aexports.detectCharsetStream = detectCharsetStream
 ;%0Aex

Add detectCharsetStream that detects charset of readable streams; Close #3