6. Accessing the File System from Node.js

Interacting with the file system in Node.js is extremely important, especially if you need to manage dynamic files to support a web application or service. Node.js provides a good interface for interacting with the file system in the fs module. This module provides the standard file access APIs that are available in most languages to open, read, write, and interact with files.

This chapter explains the fundamentals of accessing the file system from Node.js applications. You should come away with the ability to create, read, and modify files as well as navigate the directory structure. You will also be able to access file and folder information and delete, truncate, and rename files and folders.

For all the file system calls discussed in this chapter, you need to have loaded the fs module, for example:

var fs  = require('fs'),

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.113.80