I play with a tiny web server, and I implement one version using the async package, and one synchronous version executing each request in a separate isolate. I would like to just transfer the file stream to HttpResponse , but I cannot do it synchronously. And I can’t find a way to not wait for either Stream or a Future synchronously. Now I use RandomAccessFile , which works, but it gets messy.
One solution would be to run a periodic timer to check if the future is complete (by setting a logical or similar), but this is definitely not what I want to use.
Is there a way to wait in sync for Future and a Stream ? If not, why?
source share