简体   繁体   中英

How to check if file exists locally in JavaScript?

I'm writing a plugin for some tool and the API is JavaScript. I need to know whether a file exists or not, and I'd like to avoid operating system calls in order to abstract from it, but using the JavaScript language instead, if possible.

Is it possible to know if a file exists locally in JavaScript, given a path?

JavaScript has no native file handling functions whatsoever. Any access to the file system needs to be via an API provided by the host environment.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM