@ayush24k/telezipper 1.1.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,11 +2,27 @@
2
2
 
3
3
  Split folders into multiple 2GB zip files with optional Telegram upload.
4
4
 
5
+ [![npm version](https://img.shields.io/npm/v/@ayush24k/telezipper.svg)](https://www.npmjs.com/package/@ayush24k/telezipper)
6
+ [![npm downloads](https://img.shields.io/npm/dm/@ayush24k/telezipper.svg)](https://www.npmjs.com/package/@ayush24k/telezipper)
7
+
5
8
  ## Installation
6
9
 
7
- Install globally using npm link:
10
+ ### Option 1: Install from npm (Recommended)
11
+
12
+ Install globally from npm:
13
+
14
+ ```bash
15
+ npm install -g @ayush24k/telezipper
16
+ ```
17
+
18
+ Now you can use `telezipper` from anywhere on your system!
19
+
20
+ ### Option 2: Install from source
21
+
22
+ Clone the repository and link locally:
8
23
 
9
24
  ```bash
25
+ git clone https://github.com/ayush24k/teleZipper.git
10
26
  cd /path/to/telezipper
11
27
  npm install
12
28
  npm run build
@@ -28,6 +44,17 @@ Example:
28
44
  telezipper ./my-folder -o ./output
29
45
  ```
30
46
 
47
+ ### With Password Protection
48
+
49
+ ```bash
50
+ telezipper <source> -p <password> -o <output-directory>
51
+ ```
52
+
53
+ Example:
54
+ ```bash
55
+ telezipper ./my-folder -p MySecurePassword123 -o ./output
56
+ ```
57
+
31
58
  ### With Telegram Upload
32
59
 
33
60
  You can provide Telegram credentials in two ways:
@@ -61,6 +88,7 @@ telezipper ./my-folder --telegram
61
88
 
62
89
  - `<source>` - File or folder to zip (required)
63
90
  - `-o, --output <dir>` - Output directory (default: "output")
91
+ - `-p, --password <password>` - Password to protect zip files (optional)
64
92
  - `--telegram` - Upload zip files to Telegram
65
93
  - `--bot-token <token>` - Telegram bot token (required if using --telegram without env vars)
66
94
  - `--chat-id <id>` - Telegram chat ID (required if using --telegram without env vars)
@@ -93,6 +121,16 @@ export TELEGRAM_CHAT_ID=987654321
93
121
  telezipper ./my-project --telegram
94
122
  ```
95
123
 
124
+ ### Zip with password protection
125
+ ```bash
126
+ telezipper ./my-project -p MySecurePassword123
127
+ ```
128
+
129
+ ### Zip with password and upload to Telegram
130
+ ```bash
131
+ telezipper ./my-project -p MySecurePassword123 --telegram --bot-token 123456:ABC-DEF --chat-id 987654321
132
+ ```
133
+
96
134
  ## How to Get Telegram Credentials
97
135
 
98
136
  1. **Bot Token**: Create a bot using [@BotFather](https://t.me/botfather) on Telegram
@@ -105,6 +143,7 @@ telezipper ./my-project --telegram
105
143
 
106
144
  - ✅ Automatically splits large folders into 2GB chunks
107
145
  - ✅ Creates zip files with maximum compression
146
+ - ✅ Password protection with AES-256 encryption
108
147
  - ✅ Optional Telegram upload with progress bars
109
148
  - ✅ Works from any directory on your system
110
149
  - ✅ Flexible credential management (CLI args or env vars)
@@ -14,6 +14,7 @@ const program = new commander_1.Command();
14
14
  program
15
15
  .argument("<source>", "File or folder to zip")
16
16
  .option("-o, --output <dir>", "Output directory", "output")
17
+ .option("-p, --password <password>", "Password to protect zip files")
17
18
  .option("--telegram", "Upload zip files to Telegram")
18
19
  .option("--bot-token <token>", "Telegram bot token (required if using --telegram)")
19
20
  .option("--chat-id <id>", "Telegram chat ID (required if using --telegram)")
@@ -24,11 +25,12 @@ program
24
25
  const useTelegram = program.opts().telegram || false;
25
26
  const botToken = program.opts().botToken;
26
27
  const chatId = program.opts().chatId;
27
- console.log(`🕸️ Crawling files in ${source}...`);
28
+ const password = program.opts().password;
29
+ console.log(`\n🕸️ Crawling files in ${source}...`);
28
30
  const files = await (0, crawler_1.crawl)(source);
29
- console.log(`📂 Found ${files.length} files. Chunking...`);
31
+ console.log(`📂 Found ${files.length} file${files.length !== 1 ? 's' : ''}`);
30
32
  const chunks = (0, chunking_1.chunkFiles)(files);
31
- console.log(`📦 Created ${chunks.length} chunks. Zipping...`);
32
- await (0, zipper_1.zipChunks)(chunks, outputDir, useTelegram, botToken, chatId);
33
- console.log("🎉 process done!");
33
+ console.log(`📦 Created ${chunks.length} chunk${chunks.length !== 1 ? 's' : ''} (max 2GB each)${password ? ' 🔒 Password protected' : ''}\n`);
34
+ await (0, zipper_1.zipChunks)(chunks, outputDir, useTelegram, botToken, chatId, password);
35
+ console.log(`\n🎉 All done! ${useTelegram ? 'Files uploaded to Telegram.' : `Zips saved to ${outputDir}`}`);
34
36
  })();
@@ -6,17 +6,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.uploadToTelegram = uploadToTelegram;
7
7
  const node_telegram_bot_api_1 = __importDefault(require("node-telegram-bot-api"));
8
8
  const fs_1 = __importDefault(require("fs"));
9
+ const path_1 = __importDefault(require("path"));
9
10
  const cli_progress_1 = __importDefault(require("cli-progress"));
11
+ // Suppress the polling deprecation warning
12
+ process.env.NTBA_FIX_350 = "1";
10
13
  // upload a zip file to telegram with progress bar
11
14
  async function uploadToTelegram(zipPath, botToken, chatId) {
12
15
  const bot_token = botToken || process.env.TELEGRAM_BOT_TOKEN || "";
13
16
  const chat_id = chatId || process.env.TELEGRAM_CHAT_ID || "";
14
17
  if (!bot_token || !chat_id) {
15
- throw new Error("Telegram credentials are missing. Please provide --bot-token and --chat-id or set TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID environment variables.");
18
+ throw new Error("Telegram credentials are missing. Please provide --bot-token and --chat-id or set TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID environment variables.");
16
19
  }
17
20
  const bot = new node_telegram_bot_api_1.default(bot_token, { polling: false });
18
21
  const totalSize = fs_1.default.statSync(zipPath).size;
19
- console.log(`📤 Uploading ${zipPath}`);
22
+ const fileName = path_1.default.basename(zipPath);
23
+ const fileSizeMB = (totalSize / (1024 * 1024)).toFixed(2);
24
+ console.log(`\n📤 Uploading ${fileName} (${fileSizeMB} MB)`);
20
25
  const progressBar = new cli_progress_1.default.SingleBar({
21
26
  format: "Uploading [{bar}] {percentage}% | {value}/{total} Bytes",
22
27
  }, cli_progress_1.default.Presets.shades_classic);
@@ -29,5 +34,5 @@ async function uploadToTelegram(zipPath, botToken, chatId) {
29
34
  });
30
35
  await bot.sendDocument(chat_id, stream);
31
36
  progressBar.stop();
32
- console.log("✅ Upload complete");
37
+ console.log(`✅ ${fileName} uploaded successfully`);
33
38
  }
@@ -8,21 +8,32 @@ const fs_1 = __importDefault(require("fs"));
8
8
  const path_1 = __importDefault(require("path"));
9
9
  const cli_progress_1 = __importDefault(require("cli-progress"));
10
10
  const archiver_1 = __importDefault(require("archiver"));
11
+ // @ts-ignore - archiver-zip-encrypted doesn't have types
12
+ const archiver_zip_encrypted_1 = __importDefault(require("archiver-zip-encrypted"));
11
13
  const telegramUploader_1 = require("./telegramUploader");
12
- async function zipChunks(chunks, outputDir, useTelegram, botToken, chatId) {
14
+ // Register the encrypted format
15
+ archiver_1.default.registerFormat('zip-encrypted', archiver_zip_encrypted_1.default);
16
+ async function zipChunks(chunks, outputDir, useTelegram, botToken, chatId, password) {
13
17
  fs_1.default.mkdirSync(outputDir, { recursive: true });
14
18
  const uploadQueue = [];
15
19
  for (let i = 0; i < chunks.length; i++) {
16
20
  const zipName = `chunk_${i + 1}.zip`;
17
21
  const zipPath = path_1.default.join(outputDir, zipName);
18
- console.log(`📦 Zipping ${zipName}`);
22
+ console.log(`📦 Zipping ${zipName}...`);
19
23
  const progressBar = new cli_progress_1.default.SingleBar({
20
24
  format: `Zipping ${zipName} [{bar}] {percentage}% | {value}/{total} files`,
21
25
  }, cli_progress_1.default.Presets.shades_classic);
22
26
  progressBar.start(chunks[i].length, 0);
23
27
  await new Promise((resolve, reject) => {
24
28
  const output = fs_1.default.createWriteStream(zipPath);
25
- const archive = (0, archiver_1.default)("zip", { zlib: { level: 9 } });
29
+ // Use encrypted archiver if password is provided
30
+ const archive = password
31
+ ? (0, archiver_1.default)("zip-encrypted", {
32
+ zlib: { level: 9 },
33
+ encryptionMethod: 'aes256',
34
+ password: password
35
+ })
36
+ : (0, archiver_1.default)("zip", { zlib: { level: 9 } });
26
37
  archive.pipe(output);
27
38
  output.on("close", () => {
28
39
  progressBar.stop();
@@ -41,7 +52,7 @@ async function zipChunks(chunks, outputDir, useTelegram, botToken, chatId) {
41
52
  });
42
53
  }
43
54
  if (useTelegram) {
44
- console.log("🚀 Uploading all zips to Telegram...");
55
+ console.log("\n🚀 Uploading all files to Telegram...");
45
56
  await Promise.all(uploadQueue);
46
57
  }
47
58
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ayush24k/telezipper",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "description": "Split folders into multiple 2GB zip files with optional Telegram upload made for personal use.",
5
5
  "files": [
6
6
  "dist"
@@ -12,11 +12,26 @@
12
12
  "test": "echo \"Error: no test specified\" && exit 1",
13
13
  "build": "tsc"
14
14
  },
15
- "keywords": [],
16
- "author": "",
15
+ "keywords": [
16
+ "telegram",
17
+ "zip",
18
+ "file-upload",
19
+ "chunking",
20
+ "cli",
21
+ "telegram-bot",
22
+ "file-compression",
23
+ "archiver"
24
+ ],
25
+ "author": "ayush24k",
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "https://github.com/ayush24k/teleZipper.git"
29
+ },
30
+ "homepage": "https://github.com/ayush24k/teleZipper#readme",
17
31
  "license": "ISC",
18
32
  "dependencies": {
19
33
  "archiver": "^7.0.1",
34
+ "archiver-zip-encrypted": "^2.0.0",
20
35
  "cli-progress": "^3.12.0",
21
36
  "commander": "^14.0.2",
22
37
  "dotenv": "^17.2.3",