Skip to content

Commit causing Buffer error when executing in browser, not Node environment #133

Open
@willjstevens

Description

@willjstevens

This commit (line 36 in retrieve.js) breaks the extract call is giving the following error when executing in a browser such as Chrome:

Uncaught (in promise) ReferenceError: Buffer is not defined at __WEBPACK_DEFAULT_EXPORT__ (retrieve.js:58:1) at async extract

Screenshot 2024-05-18 at 3 19 16 PM

The reason is that Buffer object is only available in a Node environment, not in a browser library.

You either want to rewrite it to not depend on that Node Buffer class or rewrite the line something like:

const text = (buffer && Buffer) ? Buffer.from(buffer).toString().trim() : ''

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions