Working with files in JavaScript (Node.js)

Node.js is the server side version of JavaScript. Since it is not limited by the web browser, we can access files on the file system. Here are several code snippets that demonstrate how to read, write, move, delete, change ownership, change permission, check if exists, and get statistics file size, timestamps, and ownership for files.