   ctx = canvas.getContext '2d'
   imageData = ctx.getImageData 0, 0, canvas.width, canvas.height
   data = imageData.data
-
   tmpFile = new temporary.File
 
   rs = canvas.pngStream()

onEnd = (tmpFile, cascade, callback) ->
  bin = path.join __dirname, '../build/Release/scddetect'
  exec "#{bin} #{tmpFile.path} #{cascade}", (err, stdout, stderr) ->
    console.log 'stdout', stdout
    console.log 'stderr', stderr
    console.log 'err', err
    if err
      callback err
      tmpFile.unlink()

      return
    ws.once 'close', ->
      fs.fsync fd, ->
        try
          onEnd tmpFile, cascade, callback
        catch error
