Skip to content

Commit

Permalink
fix: return SVGs as UInt8Array
Browse files Browse the repository at this point in the history
Currently, SVGs are returned as `Buffer`s from `renderMermaid()`, which
is almost compatible with `UInt8Array`, but not 100%, which was causing
TypeScript 5.6 to throw an error.

See: #746
  • Loading branch information
aloisklink committed Oct 29, 2024
1 parent ba84e72 commit 35c779e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ async function renderMermaid (browser, definition, outputFormat, { viewport, bac
})
return {
...metadata,
data: Buffer.from(svgXML, 'utf8')
data: new TextEncoder().encode(svgXML)
}
} else if (outputFormat === 'png') {
const clip = await page.$eval('svg', svg => {
Expand Down

0 comments on commit 35c779e

Please sign in to comment.