briandesousa / node-file-processing

Demonstration of file processing using the Node fs module

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Comprehensive Guide to File Processing in Node

This repository contains a comprehensive demonstration of file, directory and link functions provided by the built-in Node.js fs module.

The fs module includes 3 different types of APIs (callback, promise, sync). Examples in this repository are built using the newest, promise-based API. There are a few examples of the callback and sync APIs for comparison purposes.

Usage

Run sudo node index.js to run all examples.

All files, directories and links that are generated by this script are contained in the data folder. The contents of the data folder is reset automatically as required. You can safely re-run this script repeatedly.

The examples in this script are intended to be run in a Linux environment. While they can be run in Windows, several examples will behave differently and even return errors in cases where the Windows file system doesn't support the capability being demonstrated.

Some examples in this script change the ownership of files and directories to the root user and group. If the script is not run with superuser privileges (sudo), those examples will fail with an access error.

This script has been tested on Node.js 16.x.

About

Demonstration of file processing using the Node fs module


Languages

Language:JavaScript 100.0%