CLI to demonstrate how to read, write, and copy files using streams.
- Install Node.js
- Clone the repo
git clone https://github.com/nightwolfdev/stream-file-cli.git
- Navigate to the project folder
cd stream-file-cli
./stream-file <command> <path_to_file>
- <command> can be:
- read: Print the file's contents to the terminal
- write: Write a message from the terminal to a file
- copy: Create a copy of a file in the current directory
- <path_to_file> is the path to the file you want to work with
- Read a file:
./stream-file read lorem-ipsum.txt
- Write a file:
./stream-file write test.txt
- Copy a file:
./stream-file copy lorem-ipsum.txt
If you cannot run the program due to a Permission denied error, run the following command to provide the file with executable permissions: chmod +x stream-file
.