Return file from GraphQL resolve

GraphQL uses JSON format, which represents as text format, not as binary.

If you don’t want download files with REST, then you should:

  1. Encode your file content into base64 string in the back end. Related question
  2. Send this string as part of query response.
  3. Save encoded base64 string as a file in the front end. Related question

But right architecture design is add a file link in the GraphQL response and use browser for downloading/rendering the file.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)