BobbyWibowo/lolisafe

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

camjac251 opened this issue · 1 comments

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.

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.