index.js
function(file, opt)
{
  //Check the file
  if(typeof file !== 'string'){ throw new Error('Missing file argument'); return null; }

  //Check the options
  if(typeof opt === 'undefined'){ var opt = {}; }

  //Save the file name
  this._file = file;

  //Check the encoding option
  this._encoding = (typeof opt.encoding === 'undefined') ? 'utf8' : opt.encoding.toString();

  //Check the chunk option
  this._chunk = (typeof opt.chunk === 'undefined') ? 10240 : opt.chunk;

  //Check the line break option
  this._endl = (typeof opt.endl === 'undefined') ? 0x0a : opt.endl;

  //Check the emptylines option
  this._emptyLines = (typeof opt.emptyLines === 'undefined') ? true : opt.emptyLines;

  //File object
  this._fd = null;

  //Actual position
  this._position = (typeof opt.start === 'undefined') ? 0 : opt.start;

  //Line count
  this._count = 0;

  //Events
  this._events = {};

  //Return this
  return this;
}
function(file, opt)
{
  //Check the file
  if(typeof file !== 'string'){ throw new Error('Missing file argument'); return null; }

  //Check the options
  if(typeof opt === 'undefined'){ var opt = {}; }

  //Save the file name
  this._file = file;

  //Check the encoding option
  this._encoding = (typeof opt.encoding === 'undefined') ? 'utf8' : opt.encoding.toString();

  //Check the chunk option
  this._chunk = (typeof opt.chunk === 'undefined') ? 10240 : opt.chunk;

  //Check the line break option
  this._endl = (typeof opt.endl === 'undefined') ? 0x0a : opt.endl;

  //Check the emptylines option
  this._emptyLines = (typeof opt.emptyLines === 'undefined') ? true : opt.emptyLines;

  //File object
  this._fd = null;

  //Actual position
  this._position = (typeof opt.start === 'undefined') ? 0 : opt.start;

  //Line count
  this._count = 0;

  //Events
  this._events = {};

  //Return this
  return this;
}
function ( file , opt ) { //Check the file if ( typeof file !== 'string' ) { throw new Error ( 'Missing file argument' ) ; return null ; } //Check the options if ( typeof opt === 'undefined' ) { var opt = { } ; } //Save the file name this . _file = file ; //Check the encoding option this . _encoding = ( typeof opt . encoding === 'undefined' ) ? 'utf8' : opt . encoding . toString ( ) ; //Check the chunk option this . _chunk = ( typeof opt . chunk === 'undefined' ) ? 10240 : opt . chunk ; //Check the line break option this . _endl = ( typeof opt . endl === 'undefined' ) ? 0x0a : opt . endl ; //Check the emptylines option this . _emptyLines = ( typeof opt . emptyLines === 'undefined' ) ? true : opt . emptyLines ; //File object this . _fd = null ; //Actual position this . _position = ( typeof opt . start === 'undefined' ) ? 0 : opt . start ; //Line count this . _count = 0 ; //Events this . _events = { } ; //Return this return this ; }
Read line by line object
Read line by line object