Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sendRaw #54

Open
tvortsa opened this issue Jun 27, 2024 · 3 comments
Open

sendRaw #54

tvortsa opened this issue Jun 27, 2024 · 3 comments

Comments

@tvortsa
Copy link

tvortsa commented Jun 27, 2024

sendRaw()

can you show me an example how to use it?
thank you!

@hassandraga
Copy link
Member

The Deno documentation is not fully updated yet, but the JavaScript part is the same in all wrappers:
https://webui.me/docs/2.5/#/?id=backend-send_raw

function myJavaScriptFunc(rawData) {
    `rawData` is Uint8Array type
}

@tvortsa
Copy link
Author

tvortsa commented Jun 28, 2024

Thank you very much!

But could you write an full example specifically for the sendRaw function?
I don’t understand how the raw data gets into the function on the front end and at what point this should happen?

All I want is to upload an image to the frontend page, on the backend I read the image file using deno as a binary array, how can I now send this array using sendRow and how to receive it on the backend, do I also need to do a bind?

Thank you!

@hassandraga
Copy link
Member

hassandraga commented Jun 28, 2024

could you write an full example

// Backend
Uint8Array imageArray; // ...
webui.sendRaw("myFunc", imageArray);
// Frontend
function myFunc(imageArray) {
    // `imageArray` is Uint8Array
}

need to do a bind?

No, you don't need to bind myFunc. But if did not work, please replace webui-2.dll (If Windows) with latest nightly build, or wait few days until we fully update deno wrapper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants