File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 6666 "description" : " Every modern runtime provides a way to convert byte array to and from base64." ,
6767 "example" : " // From base64 to Uint8Array\n const bytes = Uint8Array.fromBase64(base64)\n // From Uint8Array to base64\n const base64 = bytes.toBase64()"
6868 },
69+ "snippet::base64-id" : {
70+ "id" : " snippet::base64-id" ,
71+ "type" : " simple" ,
72+ "description" : " You can use `crypto.randomBytes` with `Buffer.prototype.toString` to generate a random base64 id" ,
73+ "example" : " import crypto from 'node:crypto'\n const id = crypto.randomBytes(15).toString('base64').replaceAll('+', '-').replaceAll('/', '_')"
74+ },
6975 "snippet::call-bind" : {
7076 "id" : " snippet::call-bind" ,
7177 "type" : " simple" ,
402408 "moduleName" : " base64-js" ,
403409 "replacements" : [" snippet::base64" ]
404410 },
411+ "base64id" : {
412+ "type" : " module" ,
413+ "moduleName" : " base64id" ,
414+ "replacements" : [" snippet::base64-id" ]
415+ },
405416 "call-bind" : {
406417 "type" : " module" ,
407418 "moduleName" : " call-bind" ,
You can’t perform that action at this time.
0 commit comments