title: NestJS return a fie from GridFS
body: <p>I am trying to return a file from GridFS using my Nest controller. As far as I can tell nest is not respecting my custom <code>content-type</code> header which i set to <code>application/zip</code>, as I am receiving a text content type upon return (see screenshot).</p>
  
  <p><a href="https://i.stack.imgur.com/AmD3p.png" rel="noreferrer">response data image, wrong content-type header</a></p>
  
  <p>My nest controller looks like this</p>
  
  <pre><code>  @Get(':owner/:name/v/:version/download')
    @Header('Content-Type', 'application/zip')
    async downloadByVersion(@Param('owner') owner: string, @Param('name') name: string, @Param('version') version: string, @Res() res): Promise&lt;any&gt; {
      let bundleData = await this.service.getSwimbundleByVersion(owner, name, version);
      let downloadFile = await this.service.downloadSwimbundle(bundleData['meta']['fileData']['_id']);   
      return res.pipe(downloadFile);
    }
  </code></pre>
  
  <p>Here is the service call</p>
  
  <pre><code>downloadSwimbundle(fileId: string): Promise&lt;GridFSBucketReadStream&gt; {
        return this.repository.getFile(fileId)
      }
  </code></pre>
  
  <p>which is essentially a pass-through to this.</p>
  
  <pre><code>  async getFile(fileId: string): Promise&lt;GridFSBucketReadStream&gt; {
      const db = await this.dbSource.db;
      const bucket = new GridFSBucket(db, { bucketName: this.collectionName });
      const downloadStream = bucket.openDownloadStream(new ObjectID(fileId));
  
      return new Promise&lt;GridFSBucketReadStream&gt;(resolve =&gt; {
          resolve(downloadStream)
        });
    }
  </code></pre>
  
  <p>My end goal is to call the <code>download</code> endpoint and have a browser register that it is a zip file and download it instead of seeing the binary in the browser. Any guidance on what needs to be done to get there would be greatly appreciated. Thanks for reading</p>