How can I receive a File or Blob instance from frontend ? #4197
Replies: 4 comments
-
|
Thanks for opening this. |
Beta Was this translation helpful? Give feedback.
-
My business needs to use HTMLCanvas to dynamically draw data, then convert it into images and hand it over to the Wails Golang process, |
Beta Was this translation helpful? Give feedback.
-
|
cover to base64 data as string ,then send to go. |
Beta Was this translation helpful? Give feedback.
-
|
The signature You need to serialize your data and then send it to wails like: async function greet() {
let blob = new Blob(["hello world"], { type: "text/plain;charset=utf-8" });
// base64 encoded result:
const result = btoa(await blob.text());
Greet(result).then((result) => {
greeting = result;
});
}func (a *App) Greet(blob string) string {
...
} |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
Is your feature request related to a problem? Please describe.
a simple code example here...
// js
let blob = new Blob(["hello world"], {type: "text/plain;charset=utf-8"});
await ReceiveBlob(blob)
// wails go
func (rec *app) (blob any) ReceiveBlob {
...
// when I can this function, I got
map[string]interface{}, and the map has no key , how can i receive it as a blob instance}
Describe the solution you'd like
please help me
Describe alternatives you've considered
No response
Additional context
No response
Beta Was this translation helpful? Give feedback.
All reactions