Reputation: 21
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
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