title: Streaming S3 object to VertX Http Server Response
body: <p>The title basically explains itself. </p>
  
  <p>I have a REST endpoint with <code>VertX</code>. Upon hitting it, I have some logic which results in an <code>AWS-S3</code> object. </p>
  
  <p>My previous logic was not to upload to <code>S3</code>, but to save it locally. So, I can do this at the response <code>routerCxt.response().sendFile(file_path...)</code>. </p>
  
  <p>Now that the file is in S3, I have to download it locally before I could call the above code. </p>
  
  <p>That is slow and inefficient. I would like to stream S3 object directly to the <code>response</code> object. </p>
  
  <p>In <code>Express</code>, it's something like this. <code>s3.getObject(params).createReadStream().pipe(res);</code>. </p>
  
  <p>I read a little bit, and saw that <code>VertX</code> has a class called <code>Pump</code>. But it is used by <code>vertx.fileSystem()</code> in the examples. </p>
  
  <p>I am not sure how to plug the <code>InputStream</code> from <code>S3</code>'s<code>getObjectContent()</code> to the <code>vertx.fileSystem()</code> to use <code>Pump</code>. </p>
  
  <p>I am not even sure <code>Pump</code> is the correct way because I tried to use <code>Pump</code> to return a local file, and it didn't work. </p>
  
  <pre><code>    router.get("/api/test_download").handler(rc -&gt; {
          rc.response().setChunked(true).endHandler(endHandlr -&gt; rc.response().end());
          vertx.fileSystem().open("/Users/EmptyFiles/empty.json", new OpenOptions(), ares -&gt; {
              AsyncFile file = ares.result();
              Pump pump = Pump.pump(file, rc.response());
              pump.start();
          });
      });
  </code></pre>
  
  <p>Is there any example for me to do that? </p>
  
  <p>Thanks</p>