Created
June 5, 2019 12:56
-
-
Save Andyliwr/8bf2b7f55bec18c6d8a066421ae75360 to your computer and use it in GitHub Desktop.
node判断是否为目录
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
var fs = require('fs'); | |
var stats = fs.statSync("c:\\dog.jpg"); | |
console.log('is file ? ' + stats.isFile()); | |
var stats = fs.statSync("c:\\demo"); | |
console.log('is directory ? ' + stats.isDirectory()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment