Skip to content

v5.0.0 always returns Buffer object #230

@Yazaar

Description

@Yazaar

Case description

Version 5.0.0 always return a Buffer object, compared to version 4.0.0 which returned a string if encoding option is set to 'base64'. This was introduced Sep 3, 2024 on commit :arrow-up: upgrade puppeteer to 23.2.2.

Was this transition expected by the v5.0.0 update?

Suggestion

Make node-html-to-image return a base64 string similar to v4.0.0.

Note: breaking change considering the returned data type changes from Buffer to string. Even if I did expect v5.0.0 to return a string to begin with after transitioning from v4.0.0 to v5.0.0.

const result = await element.screenshot({
path: screenshot.output,
type: screenshot.type,
omitBackground: screenshot.transparent,
encoding: screenshot.encoding,
quality: screenshot.quality,
});
screenshot.setBuffer(Buffer.from(result));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions