CHAPTER 3

image

Using the File System

In many instances within an application, you will want to work with the file system. Node.js makes this straightforward by creating a wrapper around standard file I/O operations that are present on the operating system. In Node.js these capabilities are centered around one of the Node.js native modules, fs. This chapter will provide examples of how to utilize the file-system module in your Node.js application. In this chapter you will learn how to perform these actions:

  • Retrieve directory structures
  • Navigate directories
  • Manipulate directory structures
  • Watch directories for modifications
  • Read and write files

Get Node.js Recipes: A Problem-Solution Approach now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.