Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

v0.0.6

  • Loading branch information...
commit 4de2ba8ea34e143364a1e604fb4d15d250a5e603 1 parent 0e6fc30
@gagle authored
View
2  build/buffered-reader.js
@@ -1 +1 @@
-"use strict";var EVENTS=require("events"),FS=require("fs"),PATH=require("path"),BUFFER_SIZE=16384,SLASH=PATH.normalize("/"),BufferedReader=function(a,b,c){EVENTS.EventEmitter.call(this);var d=arguments.length;d===1?(b=BUFFER_SIZE,c=null):d===2&&typeof b=="string"&&(c=b,b=BUFFER_SIZE),this._settings={encoding:c,bufferSize:b},this._fileName=a};BufferedReader.prototype=Object.create(EVENTS.EventEmitter.prototype),BufferedReader.prototype.constructor=BufferedReader,BufferedReader.prototype.read=function(){var a=FS.createReadStream(this._fileName,this._settings),b,c,d=this,e=this.listeners("character").length!==0||this.listeners("line").length!==0||this.listeners("byte").length!==0;a.on("data",function(f){c=f;var g=0,h,i,j=f.length;if(e){for(var k=0;k<j;k++){i=f[k];if(!a.encoding){d.emit("byte",i);continue}d.emit("character",i==="\r"?"\n":i);if(i==="\n"||i==="\r")h=f.slice(g,k),g=k+1,b&&(h=b.concat(h),b=null),k+1!==j&&i==="\r"&&f[k+1]==="\n"&&k++,d.emit("line",h)}if(a.encoding&&g!==j){var l=g===0?f:f.slice(g);b=b?b.concat(l):l}}d.emit("buffer",f)}),a.on("end",function(){e&&b&&d.emit("line",b),d.emit("end")}),a.on("error",function(a){d.emit("error",a)})},module.exports.BufferedReader=BufferedReader;
+"use strict";var EVENTS=require("events"),FS=require("fs"),PATH=require("path"),BUFFER_SIZE=16384,SLASH=PATH.normalize("/"),BufferedReader=function(a,b,c){EVENTS.EventEmitter.call(this);var d=arguments.length;d===1?(b=BUFFER_SIZE,c=null):d===2&&typeof b=="string"&&(c=b,b=BUFFER_SIZE),this._settings={encoding:c,bufferSize:b},this._fileName=a};BufferedReader.prototype=Object.create(EVENTS.EventEmitter.prototype),BufferedReader.prototype.constructor=BufferedReader,BufferedReader.prototype.read=function(){var a=FS.createReadStream(this._fileName,this._settings),b,c,d=this,e=this.listeners("character").length!==0||this.listeners("line").length!==0||this.listeners("byte").length!==0;a.on("data",function(f){c=f;var g=0,h,i,j=f.length;if(e){for(var k=0;k<j;k++){i=f[k];if(!a.encoding){d.emit("byte",i);continue}d.emit("character",i==="\r"?"\n":i);if(i==="\n"||i==="\r")h=f.slice(g,k),g=k+1,b&&(h=b.concat(h),b=null),k+1!==j&&i==="\r"&&f[k+1]==="\n"&&k++,d.emit("line",h)}if(a.encoding&&g!==j){var l=g===0?f:f.slice(g);b=b?b.concat(l):l}}d.emit("buffer",f)}),a.on("end",function(){e&&b&&d.emit("line",b),d.emit("end")}),a.on("error",function(a){d.emit("error",a)})},module.exports=BufferedReader;
View
23 build/package.json
@@ -1,22 +1,21 @@
{
- "name": "buffered-reader",
+ "name": "buffered-reader",
+ "version": "0.0.6",
+ "description": "Fully configurable buffered reader.",
+ "keywords": ["buffer", "reader", "line", "read line", "read file", "read text file", "file"],
"author": {
- "name": "Gabriel Llamas"
+ "name": "Gabriel Llamas"
},
- "version": "0.0.5",
- "description": "Fully configurable buffered reader.",
"repository": {
- "type": "git",
- "url": "git://github.com/Gagle/Node-BufferedReader.git"
+ "type": "git",
+ "url": "git://github.com/Gagle/Node-BufferedReader.git"
},
"engines": {
- "node": "*"
+ "node": "*"
},
- "keywords": ["buffer", "reader", "line", "read line", "read file", "read text file",
- "file"],
"licenses": [{
- "type": "MIT",
- "url": "http://www.opensource.org/licenses/mit-license.html"
+ "type": "MIT",
+ "url": "http://www.opensource.org/licenses/mit-license.html"
}],
- "main": "buffered-reader"
+ "main": "buffered-reader"
}
View
2  examples/binary.js
@@ -1,4 +1,4 @@
-var BufferedReader = require ("../build/buffered-reader").BufferedReader;
+var BufferedReader = require ("../build/buffered-reader");
new BufferedReader ("lorem ipsum 2")
.on ("error", function (error){
View
2  examples/characters.js
@@ -1,4 +1,4 @@
-var BufferedReader = require ("../build/buffered-reader").BufferedReader;
+var BufferedReader = require ("../build/buffered-reader");
/**
Two ways to read one character at a time:
View
2  examples/readLine.js
@@ -1,4 +1,4 @@
-var BufferedReader = require ("../build/buffered-reader").BufferedReader;
+var BufferedReader = require ("../build/buffered-reader");
new BufferedReader ("lorem ipsum", "utf8")
.on ("error", function (error){
View
4 src/buffered-reader.js
@@ -5,7 +5,7 @@
* @author Gabriel Llamas
* @created 10/04/2012
* @modified 16/04/2012
- * @version 0.0.5
+ * @version 0.0.6
*/
"use strict";
@@ -105,4 +105,4 @@ BufferedReader.prototype.read = function (){
});
};
-module.exports.BufferedReader = BufferedReader;
+module.exports = BufferedReader;
View
23 src/package.json
@@ -1,22 +1,21 @@
{
- "name": "buffered-reader",
+ "name": "buffered-reader",
+ "version": "0.0.6",
+ "description": "Fully configurable buffered reader.",
+ "keywords": ["buffer", "reader", "line", "read line", "read file", "read text file", "file"],
"author": {
- "name": "Gabriel Llamas"
+ "name": "Gabriel Llamas"
},
- "version": "0.0.5",
- "description": "Fully configurable buffered reader.",
"repository": {
- "type": "git",
- "url": "git://github.com/Gagle/Node-BufferedReader.git"
+ "type": "git",
+ "url": "git://github.com/Gagle/Node-BufferedReader.git"
},
"engines": {
- "node": "*"
+ "node": "*"
},
- "keywords": ["buffer", "reader", "line", "read line", "read file", "read text file",
- "file"],
"licenses": [{
- "type": "MIT",
- "url": "http://www.opensource.org/licenses/mit-license.html"
+ "type": "MIT",
+ "url": "http://www.opensource.org/licenses/mit-license.html"
}],
- "main": "buffered-reader"
+ "main": "buffered-reader"
}
View
2  test/playground.js
@@ -1 +1 @@
-var BufferedReader = require ("../build/buffered-reader").BufferedReader;
+var BufferedReader = require ("../build/buffered-reader");
Please sign in to comment.
Something went wrong with that request. Please try again.