浏览代码

Ajout isDir

Loquicom 5 年之前
父节点
当前提交
47b4fb9e14
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      src/file.js

+ 7 - 0
src/file.js

@@ -76,4 +76,11 @@ module.exports.getExtension = function (filename) {
     return split[split.length - 1];
 };
 
+module.exports.isDir = function (path) {
+    if (!module.exports.exist(path)) {
+        return false;
+    }
+    return fs.statSync(path).isDirectory();
+};
+
 module.exports.fs = fs;