Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Using the Play! Framework (Java):

  public static void myEndpoint() {
    HttpResponse resp = WS.url("url-of-file").get();
    InputStream is = resp.getStream();
    renderBinary(is);
  }
Or am I missing something?

(EDIT: This doesn't do the zipping or multiple files -- I guess I need a ZipOutputStream to take it the rest of the way)



I don't know the Play! framework, but the main difference probably is the use of nonblocking IO in nodejs, in contrast to blocking IO in the example you just have given. (I'm not saying either is better).


Will that definitely stream from one to the other without buffering the full file in memory? That's the main benefit of the Node.js streaming approach - it doesn't need to hold the whole thing in memory at any time, it just has to use a few KBs of RAM as a buffer.


Play! uses Apache HttpClient under the covers. I haven't tried it experimentally, but the documentation explicitly says that it's streaming.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: