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

[FeatureRequest]Could we have a primitive to return binary data from a URL #3172

Open
cymplecy opened this issue Jan 28, 2023 · 8 comments
Open

Comments

@cymplecy
Copy link
Contributor

cymplecy commented Jan 28, 2023

Just being cheeky but if you don't ask, you don't get :)

I needed to access the binary data returned from a URL request and modified your Snap! code to get it

ff2832b0617355ddc277283af5e09e04d3a46d93 (1)

Would there be some chance of getting this (but properly coded of course) as a primitive or adding it as some sort of option to to the existing one?

@jmoenig
Copy link
Owner

jmoenig commented Jan 29, 2023

nope, sorry, not as a general purpose primitive for the impending v8.1 release. Why don't you add it to your MQTT extension?

@cymplecy
Copy link
Contributor Author

Its not an MQTT thing so I wouldn't want to pollute the library :)

@jmoenig
Copy link
Owner

jmoenig commented Jan 29, 2023

Did you see the new text to utf8 and text from utf8 extension primitives? Don't those already do what you want?

@cymplecy
Copy link
Contributor Author

cymplecy commented Jan 29, 2023

Unfortunately not AFAICT - the standard URL block has already returned the data as UTF-16 (I think) so the data is already "corrupted" and the txt->utf8 isn't able to decode it correctly

The real binary returned by my JS is

TTS_textToSpeech_sound script pic (9)

The data returned by the standard URL reporter is
TTS_textToSpeech_sound script pic (10)

And AFAICT the txt->utf8 cannot recover the values at items 5,26 and 29
TTS_textToSpeech_sound script pic (11)

@cycomachead
Copy link
Collaborator

cycomachead commented Jan 29, 2023 via email

@jmoenig
Copy link
Owner

jmoenig commented Jan 30, 2023

yeah, the web services library would probably be a reasonable place to put this. We do have an extension primitive for importing a costume from a url since last summer, btw.

@cymplecy
Copy link
Contributor Author

Just re-raising this (given all the discussion about importing large amounts of data)

@jmoenig
Copy link
Owner

jmoenig commented Dec 7, 2023

Coming in one of the next patches, I've already implemented it for the upcoming AstroSnap! extension.

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

3 participants