change deprecated btoa into Buffer.from

This commit is contained in:
Yokozuna59
2023-07-17 15:58:58 +03:00
parent 662eb431ab
commit d9314a869a

View File

@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { Buffer } from 'buffer';
import type { MermaidConfig } from '../../packages/mermaid/src/config.type.js';
type CypressConfig = {
@@ -13,7 +15,7 @@ interface CodeObject {
}
const utf8ToB64 = (str: string): string => {
return window.btoa(decodeURIComponent(encodeURIComponent(str)));
return Buffer.from(decodeURIComponent(encodeURIComponent(str))).toString('base64');
};
const batchId: string = 'mermaid-batch-' + Cypress.env('CYPRESS_COMMIT') || Date.now().toString();