We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0a86871 commit f2d24c9Copy full SHA for f2d24c9
1 file changed
blog/26-04-26/x509-certificates-in-js---encrypt-decrypt-data/ex/x509-nodejs.js
@@ -80,32 +80,15 @@
80
}//blob_b64
81
82
83
-
84
85
86
- async function blob_b64(blob){
87
88
- var buf = await blob.arrayBuffer();
89
- var bytes = new Uint8Array(buf);
90
- var bin = bytes.reduce((acc,byte)=>acc+=String.fromCharCode(byte),'');
91
- var b64 = btoa(bin);
92
- return b64;
93
94
- }//blob_b64
95
96
97
function b64_blob(b64){
98
99
- var bin = atob(b64);
100
- var bytes = [...bin].map(c=>c.charCodeAt(0));
101
- var buf = new Uint8Array(bytes);
+ var buf = Buffer.from(b64,'base64');
102
var blob = new Blob([buf]);
103
return blob;
104
105
}//b64_blob
106
107
108
109
//:
110
111
0 commit comments