ibrod83 / nodejs-file-downloader

130 stars 23 forks source link

operation not permitted mkdir c:\ #64

Open xmsz-stu opened 6 months ago

xmsz-stu commented 6 months ago
const a = new Downloader({
  url: 'xxx',
  directory: 'c:/',
}).download().then(console.log).catch(console.error);
operation not permitted mkdir c:\

I saw https://github.com/ibrod83/nodejs-file-downloader/blob/0cc96f11b6d6e4879855681db97a54c9ba9840c4/Download.js#L175

why need to mkdir dir?

ibrod83 commented 5 months ago

Yes this is a flaw. I'm always calling mkdir to make sure the directory exists. I didn't account for cases like yours, when such a dir cannot be created.