Check user's permissions on file/dir in Nodejs
Omar Dulaimi

Omar Dulaimi @omardulaimi

Location:
Amman, Jordan
Joined:
Jul 20, 2019

Check user's permissions on file/dir in Nodejs

Publish Date: Aug 9 '22
4 0

The 𝗳𝘀𝗣𝗿𝗼𝗺𝗶𝘀𝗲𝘀.𝗮𝗰𝗰𝗲𝘀𝘀 method tests a user's permissions for the file or directory specified by path.

This is the recommended method by 𝗡𝗼𝗱𝗲𝗷𝘀 and the replacement of 𝗳𝘀.𝗲𝘅𝗶𝘀𝘁𝘀, as it was deprecated.

Also it's usually not a good idea to use the sync version 𝗳𝘀.𝗲𝘅𝗶𝘀𝘁𝘀𝗦𝘆𝗻𝗰 since it blocks the main thread.

It's better than 𝗳𝘀.𝗲𝘅𝗶𝘀𝘁𝘀 as you can see; promisified and provides more modes than just checking if the file exists.

I enjoyed learning about this method, hopefully you did too!


Did you learn something new today?

Like and share this post, and follow me for more!

access method

Comments 0 total

    Add comment