Mr A
Mr A

Reputation: 1385

Error 4058 on mkdir

I am planning to save my resized image to a directory that is not yet created. This is my first time doing file manipulation on nodejs, and for some reason I am having this error. Am I missing something?

enter image description here

Code Here: http://pastebin.com/LxRqciXN

Upvotes: 0

Views: 936

Answers (1)

zangw
zangw

Reputation: 48376

If you try to create a folder inside one non existing folder through fs.mkdir. This error 4058 could come up. This problem can be solved by fs-extra module

var fs = require('fs-extra')

fs.mkdirs('/tmp/some/long/path/that/prob/doesnt/exist', function (err) {
  if (err) return console.error(err)
  console.log("success!")
})

Upvotes: 1

Related Questions