📌  相关文章
📜  javascript fs 使用文件夹写入文件 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:15.608000             🧑  作者: Mango

代码示例1
var path = require('path'),
    fs = require('fs');

function ensureDirectoryExistence(filePath) {
  var dirname = path.dirname(filePath);
  if (fs.existsSync(dirname)) {
    return true;
  }
  ensureDirectoryExistence(dirname);
  fs.mkdirSync(dirname);
}