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
It doesn't reject the promise if you give it an non-existent file as the input is a glob pattern, not a file path. So if running the glob patterns results in zero files, that might be expected or it might not. It's not for us to decide. We could try to detect whether the input is an actual file path or a glob, and if it's a file path and it doesn't exist, we could throw, but that is not easy to get right. We could maybe add a glob: false option where it would then fail loudly if some of the given file paths don't exist.
However, it does reject the promise if something wrong happened while moving the files to the trash.
The behavior should be better documented regardless though.
README claims
trash()
returns a Promise, but the expected type isvoid
?trash/index.test-d.ts
Line 4 in bdfbd07
So there is currently no way to tell whether the library succeeded in moving a file into the trash or whether it encountered an error?
So, the library just sends a command to the OS and doesn't know what happens after?
When you tell the library to delete a non-existing file, it behaves the same way (no error, no notification).
This isn't a problem -- it's just that I'd love to have my app respond appropriately, not just assume that deletion occurred correctly 😓
I can manually get node to check whether the file is present to confirm it was deleted, but would be great if I didn't have to 😅
Please let me know if I'm misunderstanding something.
The text was updated successfully, but these errors were encountered: