Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArrayBuffer error #166

Closed
jchapelle opened this issue Nov 13, 2020 · 4 comments
Closed

ArrayBuffer error #166

jchapelle opened this issue Nov 13, 2020 · 4 comments
Assignees
Labels

Comments

@jchapelle
Copy link

jchapelle commented Nov 13, 2020

Hey I'm trying to render an image fetched via node-fetch but it doesn't seem to work.
Node-fetch provide a method to convert the data in arrayBuffer.
But when I'm using it, the library tells me that image data must be an arrayBuffer.
Do you have an idea why ?

import * as fetch from 'node-fetch';

const stamp = await fetch('https://www.emc-imc.org/fileadmin/_processed_/5/7/csm_STAMP_logo_transparent_72ppi_8ff95cb9e4.png');

const imageData = {
            width: 3,
            height: 3,
            extension: '.png',
            data: (await stamp.arrayBuffer())
        };

@jjhbw
Copy link
Collaborator

jjhbw commented Nov 13, 2020

Thanks for your report. It seems I made a mistake in the function I wrote to check for valid image data.

You can work around this for now by converting your ArrayBuffer to a Buffer using Buffer.from(). I'll push a fix release later today.

@jjhbw jjhbw self-assigned this Nov 13, 2020
@jjhbw jjhbw added the bug label Nov 13, 2020
jjhbw added a commit that referenced this issue Nov 13, 2020
jjhbw added a commit that referenced this issue Nov 13, 2020
…valid image data containers, as the type definitions suggest.
@jjhbw
Copy link
Collaborator

jjhbw commented Nov 13, 2020

Should be fixed in 4.5.2.

@jjhbw jjhbw closed this as completed Nov 13, 2020
@jchapelle
Copy link
Author

jchapelle commented Nov 13, 2020 via email

@jchapelle
Copy link
Author

Great !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants