Return file from GraphQL resolveSaving binary data as file using JavaScript from a browserReadFile in Base64 NodejsHow do I check whether a file exists without exceptions?How do I copy a file in Python?How do I create a Java string from the contents of a file?Undo working copy modifications of one file in Git?How do I include a JavaScript file in another JavaScript file?Writing files in Node.jsHow to read a file line-by-line into a list?How do you append to a file in Python?What's the difference between dependencies, devDependencies and peerDependencies in npm package.json file?REST API router forward to Apollo GraphQL endpoinr
What do the positive and negative (+/-) transmit and receive pins mean on Ethernet cables?
categorizing a variable turns it from insignificant to significant
Pre-Employment Background Check With Consent For Future Checks
How can an organ that provides biological immortality be unable to regenerate?
"Marked down as someone wanting to sell shares." What does that mean?
Did I make a mistake by ccing email to boss to others?
Put the phone down / Put down the phone
Would this string work as string?
Hashing password to increase entropy
What 1968 Moog synthesizer was used in the Movie Apollo 11?
Friend wants my recommendation but I don't want to give it to him
Is there any common country to visit for persons holding UK and Schengen visas?
How can I, as DM, avoid the Conga Line of Death occurring when implementing some form of flanking rule?
How to preserve electronics (computers, ipads, phones) for hundreds of years?
How are passwords stolen from companies if they only store hashes?
How can a new country break out from a developed country without war?
How do you say "Trust your struggle." in French?
Is there a page on which I can view all Sitecore jobs running?
PTIJ: Which Dr. Seuss books should one obtain?
Can you take a "free object interaction" while incapacitated?
Connection Between Knot Theory and Number Theory
Why does the frost depth increase when the surface temperature warms up?
Why is implicit conversion not ambiguous for non-primitive types?
python displays `n` instead of breaking a line
Return file from GraphQL resolve
Saving binary data as file using JavaScript from a browserReadFile in Base64 NodejsHow do I check whether a file exists without exceptions?How do I copy a file in Python?How do I create a Java string from the contents of a file?Undo working copy modifications of one file in Git?How do I include a JavaScript file in another JavaScript file?Writing files in Node.jsHow to read a file line-by-line into a list?How do you append to a file in Python?What's the difference between dependencies, devDependencies and peerDependencies in npm package.json file?REST API router forward to Apollo GraphQL endpoinr
I am currently working on an application with the current tech stack:
Backend:
Mongoose
Express
Apollo
GraphQL
Frontend:
Vuejs
Apollo
GraphQL
I have succeeded in uploading files to the server using GraphQL, what I am stuck with is how to implement the 'download' feature. With a normal RESTApi endpoint I can use res.download(filePath) and it works. How do I do this with GraphQL since I don't want to use REST.
Or is there any other standard to go by in this scenario?
Thanks!
node.js file express download graphql
add a comment |
I am currently working on an application with the current tech stack:
Backend:
Mongoose
Express
Apollo
GraphQL
Frontend:
Vuejs
Apollo
GraphQL
I have succeeded in uploading files to the server using GraphQL, what I am stuck with is how to implement the 'download' feature. With a normal RESTApi endpoint I can use res.download(filePath) and it works. How do I do this with GraphQL since I don't want to use REST.
Or is there any other standard to go by in this scenario?
Thanks!
node.js file express download graphql
add a comment |
I am currently working on an application with the current tech stack:
Backend:
Mongoose
Express
Apollo
GraphQL
Frontend:
Vuejs
Apollo
GraphQL
I have succeeded in uploading files to the server using GraphQL, what I am stuck with is how to implement the 'download' feature. With a normal RESTApi endpoint I can use res.download(filePath) and it works. How do I do this with GraphQL since I don't want to use REST.
Or is there any other standard to go by in this scenario?
Thanks!
node.js file express download graphql
I am currently working on an application with the current tech stack:
Backend:
Mongoose
Express
Apollo
GraphQL
Frontend:
Vuejs
Apollo
GraphQL
I have succeeded in uploading files to the server using GraphQL, what I am stuck with is how to implement the 'download' feature. With a normal RESTApi endpoint I can use res.download(filePath) and it works. How do I do this with GraphQL since I don't want to use REST.
Or is there any other standard to go by in this scenario?
Thanks!
node.js file express download graphql
node.js file express download graphql
asked Mar 4 at 12:16
Edd ChangEdd Chang
368
368
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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 on BE. Related question
- Send this string as part of query response.
- Save encoded base64 string as a file on FE. Related question
But right architecture design is add a file link in the GraphQL response and use browser for downloading/rendering the file.
thank you, this solves everything
– Edd Chang
Mar 7 at 10:30
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54983080%2freturn-file-from-graphql-resolve%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
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 on BE. Related question
- Send this string as part of query response.
- Save encoded base64 string as a file on FE. Related question
But right architecture design is add a file link in the GraphQL response and use browser for downloading/rendering the file.
thank you, this solves everything
– Edd Chang
Mar 7 at 10:30
add a comment |
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 on BE. Related question
- Send this string as part of query response.
- Save encoded base64 string as a file on FE. Related question
But right architecture design is add a file link in the GraphQL response and use browser for downloading/rendering the file.
thank you, this solves everything
– Edd Chang
Mar 7 at 10:30
add a comment |
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 on BE. Related question
- Send this string as part of query response.
- Save encoded base64 string as a file on FE. Related question
But right architecture design is add a file link in the GraphQL response and use browser for downloading/rendering the file.
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 on BE. Related question
- Send this string as part of query response.
- Save encoded base64 string as a file on FE. Related question
But right architecture design is add a file link in the GraphQL response and use browser for downloading/rendering the file.
answered Mar 7 at 0:11
galkingalkin
2,57621537
2,57621537
thank you, this solves everything
– Edd Chang
Mar 7 at 10:30
add a comment |
thank you, this solves everything
– Edd Chang
Mar 7 at 10:30
thank you, this solves everything
– Edd Chang
Mar 7 at 10:30
thank you, this solves everything
– Edd Chang
Mar 7 at 10:30
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54983080%2freturn-file-from-graphql-resolve%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown