The File System

For many JavaScript developers, access to the file system has been difficult to achieve. The reasoning has always been—rightfully so—that giving a Web script access to the file system was too much of a security risk. However, Node doesn’t typically execute arbitrary scripts from dark corners of the Internet. As a full-blown server-side language, Node has all of the same rights and responsibilities that languages like PHP, Python, and Java do. Thus, for JavaScript developers, the file system is a reality that doesn’t depend on vendor-specific implementations or hacks. This chapter shows how the file system can be just another tool in the Node developer’s toolbox.