mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Support server side use cases
This commit is contained in:
parent
391497916f
commit
4bd788ffcc
1 changed files with 10 additions and 4 deletions
|
@ -132,10 +132,16 @@ export class ExcalidrawFont implements Font {
|
|||
}
|
||||
|
||||
private static async toBase64(arrayBuffer: ArrayBuffer) {
|
||||
return `data:font/woff2;base64,${await stringToBase64(
|
||||
await toByteString(arrayBuffer),
|
||||
true,
|
||||
)}`;
|
||||
let base64: string;
|
||||
|
||||
if (Buffer) {
|
||||
// node + server-side
|
||||
base64 = Buffer.from(arrayBuffer).toString("base64");
|
||||
} else {
|
||||
base64 = await stringToBase64(await toByteString(arrayBuffer), true);
|
||||
}
|
||||
|
||||
return `data:font/woff2;base64,${base64}`;
|
||||
}
|
||||
|
||||
private static createUrls(uri: string): URL[] {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue