         lines = null
       else if index > -1 and index == bytesRead - 1
         # the last char is a newline
-        newRemainder = null
+        newRemainder = ''
         str = chunkedBuffer.toString("utf8", 0, bytesRead - 1)
         lines = str.split('\n')
       else

  while i--
    return i if buffer[i] == char
  -1

concat = (str1, str2) ->
  if str1? and str2?
    str1 + str2
  else if not str1? and not str2?
    ''
  else if str1?
    str1
  else
    str2

headerBuffer = new Buffer(256)
chunkedBuffer = null

  fd = fs.openSync(path, "r");
  try
    offset = 0
    remainder = ''
    return if isBinaryFile(headerBuffer, fs.readSync(fd, headerBuffer, 0, 256))

    chunkedBuffer ?= new Buffer(chunkSize)
