19.7 Advanced Operations
Up to this point, you’ve been mostly concerned with the basics of file system operations. Specifically, you’ve seen how to work with files or apply various operations to directories. Here, you’ll now learn about other operations provided by the fs module.
The first feature discussed here, you already got to know to some extent in the preceding example. It’s the stats class, which enables you to obtain information about files and directories. Like all the methods you’ve seen so far, the stat method that is used to create a stats object is asynchronous. This means that it accepts a callback function as a second argument in addition to the path to be inspected. When the operation is complete, this callback function receives ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access