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

this is an empty object while in ... on("parsed" ... #282

Open
TheAwesome98-Real opened this issue Dec 23, 2021 · 2 comments
Open

this is an empty object while in ... on("parsed" ... #282

TheAwesome98-Real opened this issue Dec 23, 2021 · 2 comments

Comments

@TheAwesome98-Real
Copy link

if i do this:

filesystem.createReadStream(path.join(__dirname, `/../images/${image}.png`)).pipe(new png({filterType: 4})).on("parsed", () => {
  console.dir(this);
});

i get:

{}

but it should have width and height. i don't think this is an issue with my code as it's modified code from the tutorial thing (with the parsing for loop removed for this example).

@CubeBR
Copy link

CubeBR commented Dec 27, 2021

this changes context depending on whether you are using arrow functions or not, try:

.on("parsed", function () {
  console.dir(this);
});

@TheAwesome98-Real
Copy link
Author

Okay, I'll try that.

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

2 participants