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

[question] When do you need this? #24

Closed
jimmywarting opened this issue Oct 25, 2018 · 9 comments
Closed

[question] When do you need this? #24

jimmywarting opened this issue Oct 25, 2018 · 9 comments

Comments

@jimmywarting
Copy link

Is this not needed if you only target node v6 and upwards?

@jimmywarting jimmywarting changed the title When do you need this? [question] When do you need this? Oct 25, 2018
@lonix1
Copy link

lonix1 commented Mar 8, 2019

@jimmywarting Hey Jimmy did you figure this out? I'm also wondering about that...

@jimmywarting
Copy link
Author

no, but my assumption is if you need to support node version lower then 6 you should maybe need this lib.

@lonix1
Copy link

lonix1 commented Mar 8, 2019

Yeah that's what I think - this is obsolete if you are using the latest node.

I just do

Buffer.from("base64string", "base64").toString("utf8");

@jimmywarting
Copy link
Author

jimmywarting commented Mar 8, 2019

Same, same. But i try to use Uint8Array instead of Buffer whenever possible if the other functionality is not needed... Gives you a better cross browser/node/deno support and the browser bundle will be a lot smaller.

@lonix1
Copy link

lonix1 commented Mar 8, 2019

Interesting... I've been using Buffer in my server app (node), and window.atob / window.btoa in my client app (angular).

@jimmywarting
Copy link
Author

jimmywarting commented Mar 8, 2019

i try to avoid base64 whenever possible, base64 is roughly ~33% larger in memory/size and it takes time to compile back and forth between binary and base64. Blobs and typed arrays is a good candidate when dealing with data

For example, when i want to display an image i use URL.createObjectURL(blob) instead of a base64 image url

@lonix1
Copy link

lonix1 commented Mar 8, 2019

Good to know, thanks!

@feross
Copy link
Owner

feross commented Jul 5, 2019

If you're using this package purely as a shim, then it should not be needed in Node 6 or higher since Buffer.alloc, etc. are built in.

@feross feross closed this as completed Jul 5, 2019
@jimmywarting
Copy link
Author

Should this be like deprecated now, feels like it have done it's part...

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