是否有可能使用Javascript(不在浏览器中)检查文件是否存在于磁盘上? [英] Is it possible to check if a file exists on disk using Javascript (not running in a browser)?

查看:106
本文介绍了是否有可能使用Javascript(不在浏览器中)检查文件是否存在于磁盘上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的应用程序的应用程序的唯一脚本语言是Javascript。所以我有一个INI文件,我需要检查它是否存在,这是可能的吗?

I am using an app where the app's only scripting language is Javascript. So I have an INI file I need to check to see if it exists, is this possible?

另外,如果它不存在,我怎么能停止执行?

Also if it doesn't exist, how can I halt the execution?

推荐答案

确定做这样的工作:

var file = new File(datafile);
var result = file.open ('r');

if result true ,则文件存在,否则 false 表示文件不存在。

if result is true, then the file exists, otherwise false means the file does not exist.

这篇关于是否有可能使用Javascript(不在浏览器中)检查文件是否存在于磁盘上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆