raszi / node-tmp

Temporary file and directory creator for node.js
MIT License
731 stars 93 forks source link

Explicit cleanup operation #298

Open kibertoad opened 1 month ago

kibertoad commented 1 month ago

Tmp Version

0.2.3

Expected Behavior

It would be great if tmp exposed a synchronous cleanup operation, which would remove all the controlled files when called. This method could be used in afterEach test blocks.

Experienced Behavior

Currently only setGracefulCleanup method exists, which does not work reliably with test runners.

silkentrance commented 4 weeks ago

depending on your host operating system, the cleanup operation might also not work as some os tend to keep locks on files. so, we cannot do anything about that.

raszi commented 2 weeks ago

I welcome the idea, which aligns with what I considered doing in the TypeScript refactor branch.

Of course, the dependent would need to close the file descriptors to be able to do this, but that is also the case for the graceful cleanup feature, that I would like to sunset.