r0x0r / pywebview

Build GUI for your Python program with JavaScript, HTML, and CSS
https://pywebview.flowrl.com
BSD 3-Clause "New" or "Revised" License
4.62k stars 537 forks source link

ability to return binary data to frontend #1430

Closed AnupamKris closed 1 day ago

AnupamKris commented 2 months ago

Specification

Description

Is it possible to return a binary data as such to frontend rather than converting it into a string and parsing in js?

Practicalities

r0x0r commented 1 month ago

You may serve binary data using a custom http server. Data passed between frontend and backend using js api is serialised using JSON. Encoding binary as base64 or such is one option, but it is probably not suitable for serving large amounts of data.

AnupamKris commented 1 month ago

But can I use the custom http server the same way as exposing functions or should I use fetch or axios to use it?

r0x0r commented 1 month ago

You can use js api with an external http server, but you would need to fetch binary data exposed by http server using rest api.

github-actions[bot] commented 6 days ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] commented 1 day ago

The message to post on the issue when closing it. If none provided, will not comment when closing an issue.