           reader.onerror = (event) =>
             console.error event.target.error.code
             sendResponse "Cannot read file"
-
           reader.readAsArrayBuffer(file)
         , (e) ->
           sendResponse "Cannot read file"

  getDumpURL : (sendResponse) =>
    sendResponse @DumpURL

  writeNextChunk : (remainingDump) =>
    if remainingDump.length is 0
      return

    if remainingDump.length > @chunkSize
      chunk = remainingDump.substring(0,@chunkSize)
      remainingDump = remainingDump.substring(@chunkSize)
    else
      chunk = remainingDump
      remainingDump = ""
    @fs.root.getFile 'dump.json', {create: false}, (fileEntry)=>
            fileEntry.createWriter (fileWriter)=>

              fileWriter.onwriteend = (e) =>
                @currentCount++
                @writeNextChunk remainingDump

              fileWriter.onerror  = (e) =>
                console.log e

    return

  writeToDisk : (dump) =>
    @currentCount = 0
    window.requestFileSystem window.TEMPORARY, 1024*1024*1024, (@fs)=>
      @fs.root.getFile 'dump.json', {create: true}, (fileEntry)=>

