unenv icon indicating copy to clipboard operation
unenv copied to clipboard

implement base64url in Buffer

Open huseeiin opened this issue 11 months ago • 2 comments

Environment

latest node and unenv

Reproduction

Buffer.from('hello').toString('base64url')

Describe the bug

base64url is not implemented

Additional context

base64url is just base64.replaceAll("+", "-").replaceAll("/", "_").replace("==", "")

there's https://github.com/feross/buffer/pull/314 but the author is not proving it

Logs


huseeiin avatar Feb 14 '25 20:02 huseeiin

you can also use deno's browser-compatible polyfills for node.js builtins: https://deno.land/[email protected]/node/internal/buffer.mjs?source

huseeiin avatar Feb 17 '25 17:02 huseeiin

Do you mind to drop a PR?

Deno implementation is good, you can use this also I converted it to b64url only + small changes.

pi0 avatar Feb 17 '25 22:02 pi0