-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add PHP file_exists * Update src/php/filesystem/file_exists.js --------- Co-authored-by: Kevin van Zonneveld <vanzonneveld@gmail.com>
- Loading branch information
Showing
2 changed files
with
12 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module.exports = function file_exists(filename) { | ||
// discuss at: https://locutus.io/php/file_exists/ | ||
// original by: Erik Niebla | ||
// note 1: so this function is Node-only | ||
// example 1: file_exists('test/never-change.txt') | ||
// returns 1: true | ||
|
||
const fs = require('fs') | ||
|
||
return fs.existsSync(filename) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
module.exports.basename = require('./basename') | ||
module.exports.dirname = require('./dirname') | ||
module.exports.file_exists = require('./file_exists') | ||
module.exports.file_get_contents = require('./file_get_contents') | ||
module.exports.pathinfo = require('./pathinfo') | ||
module.exports.realpath = require('./realpath') |