Check if file exists

I'm curious if there is a function that already exists in pixi.js or MV's core for a way to check if a file exist in a directory. I'm attempting to see if a picture exists so I can modifiy a few plugins I have that throw an error if the picture does not exist, I'd rather run different piece code if the file does not exist compared to receiving an error.
I'm curious if there is a function that already exists in pixi.js or MV's core for a way to check if a file exist in a directory. I'm attempting to see if a picture exists so I can modifiy a few plugins I have that throw an error if the picture does not exist, I'd rather run different piece code if the file does not exist compared to receiving an error.



Take a look at how XHR requests are handled.


For images, look at the Bitmap.load function and follow the onerror listener.


If it comes up as 404, then it couldn't be found, and you can handle that somehow.


By default it throws an error.


This is the only approach I would recommend, given that there is no guarantee about the file system.

Original thread: https://forums.rpgmakerweb.com/threads/check-if-file-exists.61119/