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:
- Encode your file content into base64 string in the back end. Related question
- Send this string as part of query response.
- 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.