Skip to content

How to load a binary file from the server filesystem into Vite/Vue3? #9065

Discussion options

You must be logged in to vote

Hi, I am assuming you have created a new Vue3 project, which uses Vite.

In which case, you are able to make use of the Asset API to load your binary file.

The previous answers are right in saying there's not a quick and easy way to access the server file system from a Vue component/web page, since the Vue3 Vite template makes use of purely client side rendering (example: your site is built into static HTML/CSS/JS files). Therefore, the most optimal solution would be to instruct the bundler to include your binary file, using the Asset API mentioned above.

Hope this helps, I'll attach a demo when I get to my computer. 😃

Update: demo link https://codesandbox.io/p/sandbox/naughty-pine-j2zw59

Replies: 4 comments 9 replies

Comment options

You must be logged in to vote
3 replies
@three-vue-noob
Comment options

@Shyam-Chen
Comment options

@three-vue-noob
Comment options

Comment options

You must be logged in to vote
1 reply
@three-vue-noob
Comment options

Comment options

You must be logged in to vote
3 replies
@three-vue-noob
Comment options

@mbokil
Comment options

@three-vue-noob
Comment options

Comment options

You must be logged in to vote
2 replies
@three-vue-noob
Comment options

@qin-guan
Comment options

Answer selected by three-vue-noob
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
5 participants