Replies: 1 comment
-
|
I agree. See #17 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Read your "Introducing fsx" post and I think the project you're laying out looks great, one major thing stood out to me in the post as concerning and that's recursively deleting a directory via the fsx.delete function.
While I think having a simple function to do the equivalent of
rmdir -ris great and useful, abstracting it behind the same function that also deletes a single file is an invitation to dev to shoot themselves in the foot (or the head if this function is pointed at the wrong directory). All it would take is a minor bug in string concatenation and you've potentially lost a lot of valuable data.I would suggest at least splitting the delete function into deleteFile and deleteDirectory, which would effectively force the developer to relay explicit intent to do one or the other instead of leaving the choice up to the path passed into the function - each implementation can then take the necessary precautions to ensure the path is a file or a directory.
Beta Was this translation helpful? Give feedback.
All reactions