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

Guidance for returning result from read #106

Open
Toshiba01 opened this issue Feb 9, 2023 · 1 comment
Open

Guidance for returning result from read #106

Toshiba01 opened this issue Feb 9, 2023 · 1 comment

Comments

@Toshiba01
Copy link

Toshiba01 commented Feb 9, 2023

Hi,

I need a little bit of guidance:

wire.read(length, function(err, res) { // result contains a buffer of bytes });

taking in consideration this function, how can I return result value to be used in the code outside of this function?

something like: var returnedValue = wire.read(length, function(err, res){ return res})

Thank you!

@kelly
Copy link
Owner

kelly commented Feb 10, 2023

I'd recommend using Promises if you can't use the callback block.

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