[Vuejs]-Why does my csv file which I'm downloading from my node.js backend not contain csv data?

0👍

The solution is to return this:

      return new HttpResponse(
        200,
        res.body,
        {
          "content-type": res.type,
          "content-disposition": `attachment; filename="${res.filename}"`
        },
        false
      );

First, I was returning the whole object returned from getListingCSV() as the body of the HttpResponse. I changed that to res.body.

Second, I removed the base 64 encoding since that’s not necessary at all.

Third, I added content-disposition to set the filename appropriately.

Leave a comment