reader.js
function onChunk(count) {
      // If chunk read has no bytes than there is nothing left, so end a
      // collection.
      if (count === 0) return next(end)

      // Move a offset `position` with `count` towards the end unless
      // position was a `null` in which case we just keep it (`null` means
      // from a current position).
      position = position === null ? position : position + count
      // Read chunk is forwarded to a consumer that will return
      // a promise which is delivered once write is complete.
      // In a future we may switch to an approach similar to new
      // streams in node, where buffering watermarks are specified
      // via options and reads can buffer up up to that point in
      // parallel to write.
      when(next(buffer.slice(0, count), state), onDrain, onError)
    }
function onChunk(count) {
      // If chunk read has no bytes than there is nothing left, so end a
      // collection.
      if (count === 0) return next(end)

      // Move a offset `position` with `count` towards the end unless
      // position was a `null` in which case we just keep it (`null` means
      // from a current position).
      position = position === null ? position : position + count
      // Read chunk is forwarded to a consumer that will return
      // a promise which is delivered once write is complete.
      // In a future we may switch to an approach similar to new
      // streams in node, where buffering watermarks are specified
      // via options and reads can buffer up up to that point in
      // parallel to write.
      when(next(buffer.slice(0, count), state), onDrain, onError)
    }
function onChunk ( count ) { // If chunk read has no bytes than there is nothing left, so end a // collection. if ( count === 0 ) return next ( end ) // Move a offset `position` with `count` towards the end unless // position was a `null` in which case we just keep it (`null` means // from a current position). position = position === null ? position : position + count // Read chunk is forwarded to a consumer that will return // a promise which is delivered once write is complete. // In a future we may switch to an approach similar to new // streams in node, where buffering watermarks are specified // via options and reads can buffer up up to that point in // parallel to write. when ( next ( buffer . slice ( 0 , count ) , state ) , onDrain , onError ) }
Function is used to read out given `count` bytes from the file starting from the current position. Note that `position` is captured. `onChunk` handler is invoked after reading a chunk of a file.
Function is used to read out given count bytes from the file starting from the current position . Note that position is captured . onChunk handler is invoked after reading a chunk of a file .