webtoon / psd

Fast zero-dependency PSD parser for the web and Node.js
https://webtoon.github.io/psd
MIT License
1.21k stars 55 forks source link

Update README.md web browser example code #48

Closed SimDaeSoo closed 2 years ago

SimDaeSoo commented 2 years ago

readme.md web browser example not working.

Before

https://github.com/webtoon/psd/blob/8885f167ac1382a14facea47413dd9fb85bac924/README.md?plain=1#L77-L81

psdFile.composite function return Promise<Uint8ClampedArray> image

so readme.md example causing error like this image

After

so i added await keyword for psdFile.composite async func

  const compositeBuffer = await psdFile.composite(); // composite function return Promise
  const imageData = new ImageData(
    compositeBuffer,
    psdFile.width,
    psdFile.height
  );
dlehdanakf commented 2 years ago

Thanks for your pull request.