You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// based on https://github.com/substack/node-mkdirp/blob/master/index.jsfunctionmkdirPwebdav(p,opts,f,made){if(typeofopts==='function'){f=opts;opts={};}elseif(!opts||typeofopts!=='object'){opts={mode: opts};}varmode=opts.mode;// unusedvarxfs=opts.fs||fs;if(!made)made=null;varcb=f||function(){};xfs.mkdir(p,function(er){if(!er){made=made||p;returncb(null,made);}switch(er.status){case409:
mkdirP(path.dirname(p),opts,function(er,made){if(er)cb(er,made);elsemkdirP(p,opts,cb,made);});break;// In the case of any other error, just see if there's a dir// there already. If so, then hooray! If not, then something// is borked.default:
xfs.stat(p,function(er2,stat){// if the stat fails, then that's super weird.// let the original error be the failure reason.if(er2||!stat.isDirectory())cb(er,made)elsecb(null,made);});break;}});}
Sounds good to me! Happy to receive a PR for this.
It's good that webdav by default uses the recursive -> false (MKCOL) default behaviour that node implements. Not sure how best to do this but I guess it'll be a lot of stat and mkdir requests back to back.
Create a folder with all parents (like mkdir -p on unix). This would be very useful and be in line with the current fs api. See: nodejs/node#21875
The text was updated successfully, but these errors were encountered: