Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

异步上传图片 #56

Open
Harhao opened this issue Sep 17, 2018 · 0 comments
Open

异步上传图片 #56

Harhao opened this issue Sep 17, 2018 · 0 comments

Comments

@Harhao
Copy link

Harhao commented Sep 17, 2018

  • 你好,这个同步创建目录的函数,第一步判断目录路径是否存在,为什么已经存在目录路径,else中还要再进行递归地调用mkdirsSync这个函数呢??有点不太懂
function mkdirsSync( dirname ) {
  if (fs.existsSync( dirname )) {
    return true
  } else {
    if (mkdirsSync( path.dirname(dirname)) ) {
      fs.mkdirSync( dirname )
      return true
    }
  }
}
  • fs.existsSync判断传入的路径名是否存在,如果不存在,为什么把目录名传进入进行判断,创建目录文件夹?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant