-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
buffer: implement buffer.atob and buffer.btoa #37529
Conversation
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kinda feeling "meh" on repeating the web's mistakes, but I can see the point for web compat.
I also don't really see the point for this API in Node.js, especially since ours (.toString on buffer) is arguably better and this API does not actually improve web compatibility by much since it's not global (and global probably isn't worth the breakage) |
Yep. It's been a long standing open feature request, and is implemented in other platforms, it was a quick impl so I figured let's see what the reaction is. I'm fine with not having this either. I'll close this and close the feature request issue as a #wontfix. |
I'm reopening this as I've had three separate, independent conversations with different folks in the past two weeks about the lack of |
@jasnell why couldn’t they be globals? (I’m sure there’s discussion somewhere, but I’d love to read it linked from here) |
Globals are semver major. If this lands I'll open a separate commit adding that. But this way it allows us the option of backporting the basic impls to 15 and 14 |
awesome, sounds like a great plan |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just making sure this doesn’t land until it has a big, bold warning against using it (or deprecation notice, tbh – I’d personally say that introducing this as a deprecated feature from the start would be just fine, but I’m guessing not everybody’s on the same page there…)
I'd be -1 for introducing as deprecated but I'm definitely adding a notice in the docs as suggested. I definitely say we need a new status indicator in the docs that Is-Not-Deprecated-But-Is-Also-Not-Recommended |
The JS spec is going to use the term "legacy" for "things that are icky that we wish we could get rid of", if that helps :-) |
That does help, actually. There are a few APIs in core that are currently deprecated but really fall under that legacy category instead. I may have to open a PR adding that in as an option |
Signed-off-by: James M Snell <jasnell@gmail.com>
Signed-off-by: James M Snell <jasnell@gmail.com>
|
||
const lazyInvalidCharError = hideStackFrames((message, name) => { | ||
if (DOMException === undefined) | ||
DOMException = internalBinding('messaging').DOMException; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we always have to lazily load this constructor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's gotten a bit out of hand really. I'm doing it for consistency. I recently landed a PR that updated the various AbortError
instances to eliminate this in multiple places but there are still more. What would be good is a PR that moves DOMException into `internal/errors' and replaces these lazy loads for that.
I'm still -0 on this (since right now we're just adding the bad methods without improving compatibility since they're not global) but I see the merit if they're global in the next major. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Landed in 08770bc and c6855eb |
Notable changes: * buffer: * implement btoa and atob (James M Snell) #37529 * deps: * upgrade npm to 7.7.6 (Ruy Adorno) #37968 * doc: * add legacy status to stability index (James M Snell) #37784 * add @Linkgoron to collaborators (Nitzan Uziely) #37817 * http: * add http.ClientRequest.getRawHeaderNames() (simov) #37660
PR-URL: #37977 Notable changes: * buffer: * implement btoa and atob (James M Snell) #37529 * deps: * upgrade npm to 7.7.6 (Ruy Adorno) #37968 * doc: * add legacy status to stability index (James M Snell) #37784 * add @Linkgoron to collaborators (Nitzan Uziely) #37817 * http: * add http.ClientRequest.getRawHeaderNames() (simov) #37660
PR-URL: #37977 Notable changes: * buffer: * implement btoa and atob (James M Snell) #37529 * deps: * upgrade npm to 7.7.6 (Ruy Adorno) #37968 * doc: * add legacy status to stability index (James M Snell) #37784 * add @Linkgoron to collaborators (Nitzan Uziely) #37817 * http: * add http.ClientRequest.getRawHeaderNames() (simov) #37660
PR-URL: #37977 Notable changes: * buffer: * implement btoa and atob (James M Snell) #37529 * deps: * upgrade npm to 7.7.6 (Ruy Adorno) #37968 * doc: * add legacy status to stability index (James M Snell) #37784 * add @Linkgoron to collaborators (Nitzan Uziely) #37817 * http: * add http.ClientRequest.getRawHeaderNames() (simov) #37660
Web Platform atob and btoa impl.
Just an initial get it working impl, not performance optimized.
Signed-off-by: James M Snell jasnell@gmail.com
Fixes: #3462