Closed klein0r closed 2 years ago
Expected behaviour:
iobroker state getplain sayit.0.tts.mp3 > sayit.mp3
should work
Makes sense, thanks for reporting.
Or we introduce a "get-binary" command or such?
Or we introduce a "get-binary" command or such?
Or read the object first and check for obj.binary
if so getbinary state, else get state and do the formatting stuff
But yes, I think get binary would be cleaner and maybe someone wants set binary later on in the process
But yes, I think get binary would be cleaner and maybe someone wants set binary later on in the process
The question is, what get
and getplain
should return for binary states.
If you provide an additional getbinary
command, the user has to know about the difference between "normal" and "binary" states. Is that something a common user has to know?
Yes, in an optimal world we take care of this. Will cost some performance but not relevant for cli.
User discussion, maybe.. who uses cli ;-)
I have created a PR. We should discuss if a separate command makes more sense, both are "called" states but are very different in their concepts. A binary state has no attributes like a timestamp ack etc. It is always just a Buffer. Regarding output it could also be necessary to specify the encoding as mentioned in comment https://github.com/ioBroker/ioBroker.js-controller/pull/1677#discussion_r785432261
As already mentioned on the PR I think it is best to "Break" here because it never really worked in the contet was not utf-8. The state get command will get an error on binary states.
Additionally we introduce a iob state get-binary <id> <encoding>
to allow a clean binary stat ehandling and can also support to output as hex or base64 or such using that way.
We also could then add a iob state set-binary <id> <encoding>
Where data are read from stdin afterwards and processed as the given encoding.
Opinions?
Describe the bug
CLI commands return errors for binary states:
To Reproduce
file
setBinaryState
to store binary information (like an image)iobroker state get <yourStateId>
oriobroker state getplain <yourStateId>
on cliExample: