Santiago Aguilar HernandezS
Denoβ€’3y agoβ€’
3 replies
Santiago Aguilar Hernandez

Should "exists" function from STD be used as a last resort?

There was an undo deprecation for "exists" functions but still in the code it says this:

Note: Do not use this function if performing a check before another operation on that file. Doing so creates a race condition. Instead, perform the actual file operation directly.

So basically this message and the description in the PR, would mean use it but as last resort? e.g: third party scenarios?

Thanks.

https://github.com/denoland/deno_std/pull/2785
GitHub
Introduces readable Undos the deprecation and enhances exists of the fs module.
exists was deprecated due to TOCTOU issues, but there are valid use cases to have such function:

Checking for path a...
feat(fs): undo deprecation of `exists` and add permission and type ...
Was this page helpful?