var fd = use('fd')
var time = use('time')
var blob = use('blob')

var data = new blob
var st = time.number()
var f = fd.open(arg[0], 'r')
var chunksize = 4096

function getchunk()
{
  var chunk = fd.read(f,chunksize);
  data.write_blob(chunk);
  if (chunk.length < chunksize*8) {
    // we're done
    fd.close(f)
    log.console(`read took ${time.number()-st}`)
    $_.stop()
  } else
    $_.clock(getchunk)
}

getchunk()
