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

non-stream version? #356

Open
Pomax opened this issue Jun 16, 2023 · 0 comments
Open

non-stream version? #356

Pomax opened this issue Jun 16, 2023 · 0 comments

Comments

@Pomax
Copy link

Pomax commented Jun 16, 2023

Is there a version available that has a non-stream API, for more modern code like this?

import fs from "fs/promises";
imprt  { PNG } from "pngjs";

const data = await fs.readFile(`input.png`);
const image = new PNG(data, { filterType: 4 });
// ...change the pixel data etc ...
await fs.writeFile(`test.png`, image.toBytes());

// then do more things with test.png now existing

(ever since promises and the async/await syntax landed into mainline JS, streams have become more an artifact of Node versions past)

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

No branches or pull requests

1 participant