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

Example in README does not work #5

Open
gustiando opened this issue Aug 6, 2018 · 1 comment
Open

Example in README does not work #5

gustiando opened this issue Aug 6, 2018 · 1 comment

Comments

@gustiando
Copy link

Hi!

Thank you so much for creating this wonderful tool :)

I tried to execute the screenshot example, but unfortunately got an error when running the last line: File.write "screenshot.png", Base64.decode64(response["data"])

Error:
Encoding::UndefinedConversionError: "\x89" from ASCII-8BIT to UTF-8

Would you happen to know what's going on?

Thanks!

@oroup
Copy link

oroup commented Oct 1, 2019

The file needs to be opened in binary mode. This is the equivalent and works:

File.open('screenshot.png', 'wb') { |f| f.write(Base64.decode64(response["data"])) }

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