Check that a file exists.

@param {String} fileName
@return {Promise}
422862
function(fileName, content) {
                return Promise()
                .then(function() {
                    var filePath = PathUtils.resolveInRoot(outputFolder, fileName);

                    return fs.exists(filePath);
                });
            }
927424
function (filename) {
            var stat;
            try { stat = fs.statSync(filename); }
            catch (err) { stat = null; }
            return stat;
        }
469487
function tryFile(fileName, failedLookupLocation, onlyRecordFailures, state) {
        if (!onlyRecordFailures && state.host.fileExists(fileName)) {
            if (state.traceEnabled) {
                ts.trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName);
            }
            return fileName;
        }
        else {
            if (state.traceEnabled) {
                ts.trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName);
            }
            failedLookupLocation.push(fileName);
            return undefined;
        }
    }
57798
function(fileName) {
                let file = assets[fileName] || {};
                fileName = basePath + "/" + fileName.replace(/\\/g, '/');
                let key = path.posix.join(uploadPath, fileName);

                return new Promise((resolve, reject) => {
                    let begin = Date.now();
                    cos.putObject(
                        {
                            Bucket: bucket,
                            Region: region,
                            Key: key,
                            Body: fs.createReadStream(file.existsAt),
                            ContentLength: fs.statSync(file.existsAt).size
                        },
                        function(err, body) {
                            uploadedFiles++;
                            spinner.text = tip(uploadedFiles, totalFiles);

                            if (err) return reject(err);
                            body.duration = Date.now() - begin;
                            resolve(body);
                        }
                    );
                });
            }
307082
function readFile(filename) {
	return new Promise(
		(resolve, reject) => fs.readFile(filename, 'utf8',
			(error, data) => error ? reject(error) : resolve(data)
		)
	);
}
453035
function safeRecover (fileName) {
    verifyFileName (fileName);

    // if fileName exists, verify it is a file
    var info = getFileInfo (fileName);
    if ((info.exists) && (info.isFile === false)) {
        var message1 = format (cc.MSG_IS_NOT_A_FILE, fileName);
        throw new SafeFileError (cc.IS_NOT_A_FILE, message1);
    }

    // get state, if doesn't exist throw error
    var state = getState (fileName);
    if (state.status === cc.DOES_NOT_EXIST) {
        var message2 = format (cc.MSG_DOES_NOT_EXIST, fileName);
        throw new SafeFileError (cc.DOES_NOT_EXIST, message2);
    }
        
    performRecovery (state, true);
}
925174
function(fileObj) {
  return new Promise(function (resolve, reject) {
    window.requestFileSystem(window.TEMPORARY, 4*1024*1024*1024,
        function({root}){
          resolve({root:root, fileObj: fileObj})
        },
        function(err) {
          reject(err)
        }
    );
  });
}
224432
function fileExists(file) {
    var fileExists = true;

    try {
        fs.statSync(file, function(err, stat) {
            if (err == null) {
                fileExists = true;
            } else {
                fileExists = false;
            }
        });
    } catch (e) {
        fileExists = false;
    }

    return fileExists;
}
63697
function existence ( filepath ) {
		var does = grunt.file.exists ( filepath );
		if ( !does ) {
			grunt.log.warn ( filepath + " not found." );
		}
		return does;
	}
1257159
protected boolean fileExistsAndIsReadable(String filename) {

    File f = new File(filename);
    return f.exists() && f.isFile() && f.canRead();
  }
186930
def exists(self, filename):
        """"""
        client = boto3.client("s3")
        bucket, path = self.bucket_and_path(filename)
        r = client.list_objects(Bucket=bucket, Prefix=path, Delimiter="/")
        if r.get("Contents") or r.get("CommonPrefixes"):
            return True
        return False
794347
def verify_file_exists(file_name, file_location):
    
    return __os.path.isfile(__os.path.join(file_location, file_name))
522197
function _shouldKeepExisting(file, text)
{
return Promise.coroutine(function *() {
	if (!(yield fs.fileExists(file)))
		return false;

//	var st = yield fs.stat(file);
//	if (st > _ThisBuild)
//		l.logw("File is used multiple times: '" + file)+"'");

	// read the existing file and compare with new contents. ignore if nothing changed
	try
	{
		var existingText = yield fs.readFile(file, "utf8");
		if (existingText == text)
		{
			//l.vlog("Skipping (unchanged): '" + file + "'");
			return true;
		}
	}
	catch (e)
	{
		l.logw("Failed to compare existing file " + path.basename(file) + " (will try and overwrite): " + _.niceStackTrace(e));
		// and continue below...
	}
	return false;
})();
}
268011
function exists(filedir){
    // promise wrapper
    return new Promise(function(resolve){
        // try to stat the file
        _fs.stat(filedir, function(err){
            resolve(!err)
        });
    });
}
635712
def _ensure_filepath(filename):
        

        filepath = os.path.dirname(filename)
        if not os.path.exists(filepath):
            os.makedirs(filepath)
382894
function exists(file, src, opts) {
	var files = opts.path.map(function (dir) {
		return path.join(dir, file);
	});

	files = globby.sync(files);

	if (!files.length) {
		throw new Error(createError(file, src, opts.path));
	}

	return files[0];
}
365012
function write(filename, data) {
  return Promise.fromCallback(function (done) {
    debug('write', filename);
    fs.writeFile(filename, data, done);
  });
}