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

[@types/node] Buffer missing inspect() #33260

Closed
4 tasks done
unional opened this issue Feb 21, 2019 · 4 comments
Closed
4 tasks done

[@types/node] Buffer missing inspect() #33260

unional opened this issue Feb 21, 2019 · 4 comments

Comments

@unional
Copy link
Contributor

unional commented Feb 21, 2019

If you know how to fix the issue, make a pull request instead.

If you do not mention the authors the issue will be ignored.

Search Terms: Buffer inspect

The Buffer interface is missing the inspect() function:

https://nodejs.org/docs/latest/api/util.html#util_util_inspect_object_options

buffer.INSPECT_MAX_BYTES#
Added in: v0.5.4
<integer> Default: 50
Returns the maximum number of bytes that will be returned when buf.inspect() is called. This can be overridden by user modules. See util.inspect() for more details on buf.inspect() behavior.

Note that this is a property on the buffer module returned by require('buffer'), not on the Buffer global or a Buffer instance.

I agree that it is not well documented. :)

This is how console.log() prints Buffer

console.log(Buffer.from('abcde')) //  <Buffer 61 62 63 64 65>
console.log(Buffer.from('abcde').inspect()) //  <Buffer 61 62 63 64 65>

Also mentioned in SO:
https://stackoverflow.com/questions/21179524/how-to-convert-node-buffer-to-string-like-console-log-show

@SimonSchick
Copy link
Contributor

I think the inspect is deprecated in favour of the nodejs.util.inspect.custom symbol.
See nodejs/node#15549
I don't think we should add that method at this point.

@SimonSchick
Copy link
Contributor

@basarat I think this can be closed btw

@basarat
Copy link
Member

basarat commented Jul 4, 2019

Thanks 🌹

@basarat basarat closed this as completed Jul 4, 2019
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