Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const toDataUri = (page: Page): string => {
const html = `
<style>
${page.css}
</style>
${page.body}
`;
const htmlBuffer = Buffer.from(html, 'utf8');
const datauri = new Datauri();
datauri.format('.html', htmlBuffer);
return datauri.content;
};
function bufferToDataUri(type, buffer) {
return new DataUri().format(type, buffer).content;
}
export default html => {
const datauri = new Datauri();
return datauri.format('.html', html).content;
};