node-tmp icon indicating copy to clipboard operation
node-tmp copied to clipboard

Explicit cleanup operation

Open kibertoad opened this issue 1 year ago • 2 comments

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.

kibertoad avatar Jun 02 '24 09:06 kibertoad

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.

silkentrance avatar Jun 08 '24 16:06 silkentrance

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.

raszi avatar Jun 24 '24 08:06 raszi