Client download from remote URL in SvelteKit? #3893
-
In PHP, I just do something like this: $file_url = 'https://www.someremoteserver.com/remotefile.pdf'; This forces a client download without exposing the original URL. How can I do this in SvelteKit? |
Beta Was this translation helpful? Give feedback.
Answered by
mustofa-id
Feb 14, 2022
Replies: 1 comment 2 replies
-
I believe you can do it using export const get = async () => {
const res = await fetch(`your url`)
return {
headers: { /* your headers */ },
body: res.body
}
} |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
Vervo7
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I believe you can do it using
fetch
.