BobbyWibowo / lolisafe

Blazing fast file uploader and awesome bunker written in node! šŸš€
MIT License
317 stars 56 forks source link

[BUG] mkdir on yarn run doesn't create parent folders #190

Closed camjac251 closed 4 years ago

camjac251 commented 4 years ago

I believe this might be an easy fix with using mkdir -p instead of mkdir. It is trying to create the chunks folder in a nonexistent uploads folder. -p ensures that all parent folders are made if they do not exist

yarn run v1.22.4
$ node ./lolisafe.js
[2020-05-28 10:52:31] Starting lolisafeā€¦
[2020-05-28 10:52:31] [Error: ENOENT: no such file or directory, mkdir '/root/lolisafe/uploads/chunks'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'mkdir',
  path: '/root/lolisafe/uploads/chunks'
}
error Command failed with exit code 1.
BobbyWibowo commented 4 years ago

Thanks. It was actually originally meant to create uploads directory first, aka the parent. But I had the loop on Promise.all, which would instead run them all in parallel, which introduced the issue of uploads directory only being created after chunks was trying to create itself.