English 中文(简体)
如何检查是否存在档案(通过完整途径收集)? 注
原标题:How to check if a file (given by full path) exists? node js [duplicate]

I thought I could do it with the fs module, but i couldnt find the right function.

问题回答
fs = require( fs );        
fs.exists(path, function( exists ) {        
    console.log( ( exists  ? "File is there" : "File is not there" ) );         
});




相关问题
Java shell expansion similar to wordexp

Is there a way to do shell wildcard expansion in java similar to the way that the C function call wordexp works? It seems a bit platform specific, but there has to be a nice abstraction for this in ...

How to evaluate a file system?

I ve a question related to design of file systems. These days we are seeing the proliferation of many file systems mostly related to handling large datasets and providing high availability and speed. ...

Storing files on the Cloud or the FileSystem? [closed]

Simple question, doesn t seem to have been directly asked yet. What are the benefits to storing files (images/videos/documents/etc) on Amazon S3-and-related vs. on the File System your app is ...

Is this specific path concatenation in Perl code exploitable?

Assume that an attacker controls the variable $untrusted_user_supplied_path. Is the following Perl code exploitable? my $untrusted_user_supplied_path = ... if ($untrusted_user_supplied_path =~ /../)...

How to determine how much free space on a drive in Qt?

I m using Qt and want a platform-independent way of getting the available free disk space. I know in Linux I can use statfs and in Windows I can use GetDiskFreeSpaceEx(). I know boost has a way, ...

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签