A Node.js project that demonstrates advanced encryption and decryption using streams. The project implements a simple encryption logic that increments each byte by 1 and a corresponding decryption that decrements each byte.
app.ts
- Main application file containing encryption/decryption logicto_know.txt
- Input file for encryptionencrypt.txt
- Encrypted output filedecrypt.txt
- Decrypted output filepackage.json
- Project configuration and dependenciestsconfig.json
- TypeScript configuration
- Stream-based processing for memory efficiency
- Progress tracking during encryption
- Asynchronous file handling
- TypeScript implementation
The project uses two main classes:
- Extends the Node.js Transform stream.
- Encrypts data by incrementing each byte by 1.
- Tracks and displays encryption progress.
- Extends the Node.js Transform stream.
- Decrypts data by decrementing each byte by 1.
- Make sure you have Node.js (v22.6.0) installed.
npm install
- Go to the code and change the input file name in the
to_know.txt
variable. - Uncomment the
encode
function call in theapp.ts
file to encrypt the file. - Run the application.
npm start
Vice versa, to decrypt the file, uncomment the decode
function call in the app.ts
file and run the application.
- Node.js version: v22.6.0 (specified in .nvmrc)
- TypeScript