Snap
Snap copied to clipboard
[FeatureRequest]Could we have a primitive to return binary data from a URL
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
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?
nope, sorry, not as a general purpose primitive for the impending v8.1 release. Why don't you add it to your MQTT extension?
Its not an MQTT thing so I wouldn't want to pollute the library :)
Did you see the new text to utf8
and text from utf8
extension primitives? Don't those already do what you want?
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
The data returned by the standard URL reporter is
And AFAICT the txt->utf8 cannot recover the values at items 5,26 and 29
I think a tool like this makes sense in the web services library personally. It would be useful - and I don’t remember if we’ve ever added a way to nicely grab images and sounds. -- Michael BallFrom my iPhonemichaelball.coOn Jan 29, 2023, at 4:26 AM, Simon Walters @.***> wrote: Unfortunately not AFAIC - 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 the my JS is
The data returned by the standard URL reporter is
And AFAICT the txt->utf8 cannot recover the values at items 5,26 and 29
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>
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.
Just re-raising this (given all the discussion about importing large amounts of data)
Coming in one of the next patches, I've already implemented it for the upcoming AstroSnap! extension.