You should return JSON, but there is still a way. We use GraphQL to return images stored in Blob fields in the old sql database. We use sequelize, graphql-sequelize and graphql-js. We have determined that Blob fields are String types in our graphql schema, and therefore they are great for json's answer. Then we convert to buffer before delivery, for example
const imgBuffer = new Buffer.from(imgObj.data, 'ascii');
The only problem is that now we are having problems saving the image data back to the database via the graphql interface. Our mutation function gives us a syntax error when it detects some invalid Unicode characters in strings, such as \ U0000 and whatnot (so I found your question looking for a solution to this).
source
share