user3130373
user3130373

Reputation: 21

nodejs - check if image is blank

I'm creating a testing app that spits out an image for url entered by user. screenshots are taken with phantomjs + nightmarejs.

Sometimes user enters nonexistent url so image screenshot is blank. Is there any lib in nodejs that allows me to check if image is blank? or maybe a better approach?

Thanks!

Upvotes: 2

Views: 863

Answers (1)

Daniel
Daniel

Reputation: 18682

Sometimes user enters nonexistent url so image screenshot is blank. Is there any lib in nodejs that allows me to check if image is blank? or maybe a better approach?

Yes, there is a better approach. Check if URL gives you 404 error before taking screenshot and return error to user if it does.

Upvotes: 2

Related Questions