antares/src/common/libs/bufferToBase64.ts

7 lines
229 B
TypeScript
Raw Normal View History

2022-05-10 12:57:25 +02:00
export function bufferToBase64 (buf: Buffer) {
2022-08-09 17:28:33 +02:00
const binstr = Array.prototype.map.call(buf, (ch: number) => {
return String.fromCharCode(ch);
}).join('');
return Buffer.from(binstr, 'binary').toString('base64');
}