           type:       fileData.type
           size:       fileData.size
           chunk:      currentChunk
+          last:       last
           isVideo:    fileData.type.toLowerCase().indexOf("video") > -1
           isAudio:    fileData.type.toLowerCase().indexOf("audio") > -1
           isImage:    fileData.type.toLowerCase().indexOf("image") > -1

      onUploaded and onUploaded.call self, error, data

    if onBeforeUpload
      if not onBeforeUpload.call file, fileReader
        end new Meteor.Error(500, "FORBIDDEN"), null
        return false

    fileReader.onload = (chunk) ->
      onProgress and onProgress((currentChunk / chunksQty) * 100)

      binary      = chunk.srcElement or chunk.target
      arrayBuffer = new Uint8Array binary.result

      if chunksQty is 1
        Meteor.call self.methodNames.MeteorFileWrite, arrayBuffer, fileData, meta, first, chunksQty, currentChunk, randFileName, (error, data) ->
          end error, data
      else
        Meteor.call self.methodNames.MeteorFileWrite, arrayBuffer, fileData, meta, first, chunksQty, currentChunk, randFileName, (error, data)->
          if data.chunk <= chunksQty
            currentChunk = data.chunk + 1
            from         = currentChunk * self.chunkSize
            to           = from + self.chunkSize
            fileReader.readAsArrayBuffer file.slice from, to
          else
            end error, data
      first = false



    if chunksQty is 1
      fileReader.readAsArrayBuffer file
    else
      fileReader.readAsArrayBuffer file.slice 0, @chunkSize
    
    return fileReader

  ###
  @isomorphic

    console.time('insert') if @debug

    randFileName  = @namingFunction.call null, true
    self          = @
    partSize      = Math.ceil file.size / streams
    parts         = []
    uploaded      = 0
    last          = false

    i = 1
    while i <= streams
      parts.push
        from: partSize * (i-1)
        to:   partSize * i
        size: partSize
        part: i
        chunksQty: if @chunkSize < partSize then Math.ceil(partSize / @chunkSize) else 1
      # console.log "if #{@chunkSize} < #{partSize} then Math.ceil(partSize / @chunkSize) else 1", if @chunkSize < partSize then Math.ceil(partSize / @chunkSize) else 1
      i++

    # console.log parts

    end = (error, data) ->
      console.timeEnd('insert') if self.debug
