@ayush24k/telezipper 1.2.0 → 1.4.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
@@ -1,6 +1,6 @@
1
1
  # TeleZipper
2
2
 
3
- Split folders into multiple 2GB zip files with optional Telegram upload.
3
+ Split folders into multiple 50MB zip files with optional Telegram upload.
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/@ayush24k/telezipper.svg)](https://www.npmjs.com/package/@ayush24k/telezipper)
6
6
  [![npm downloads](https://img.shields.io/npm/dm/@ayush24k/telezipper.svg)](https://www.npmjs.com/package/@ayush24k/telezipper)
@@ -44,6 +44,17 @@ Example:
44
44
  telezipper ./my-folder -o ./output
45
45
  ```
46
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
+
47
58
  ### With Telegram Upload
48
59
 
49
60
  You can provide Telegram credentials in two ways:
@@ -77,6 +88,7 @@ telezipper ./my-folder --telegram
77
88
 
78
89
  - `<source>` - File or folder to zip (required)
79
90
  - `-o, --output <dir>` - Output directory (default: "output")
91
+ - `-p, --password <password>` - Password to protect zip files (optional)
80
92
  - `--telegram` - Upload zip files to Telegram
81
93
  - `--bot-token <token>` - Telegram bot token (required if using --telegram without env vars)
82
94
  - `--chat-id <id>` - Telegram chat ID (required if using --telegram without env vars)
@@ -109,6 +121,16 @@ export TELEGRAM_CHAT_ID=987654321
109
121
  telezipper ./my-project --telegram
110
122
  ```
111
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
+
112
134
  ## How to Get Telegram Credentials
113
135
 
114
136
  1. **Bot Token**: Create a bot using [@BotFather](https://t.me/botfather) on Telegram
@@ -119,8 +141,9 @@ telezipper ./my-project --telegram
119
141
 
120
142
  ## Features
121
143
 
122
- - ✅ Automatically splits large folders into 2GB chunks
144
+ - ✅ Automatically splits large folders into 50MB chunks
123
145
  - ✅ Creates zip files with maximum compression
146
+ - ✅ Password protection with AES-256 encryption
124
147
  - ✅ Optional Telegram upload with progress bars
125
148
  - ✅ Works from any directory on your system
126
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;
28
+ const password = program.opts().password;
27
29
  console.log(`\n🕸️ Crawling files in ${source}...`);
28
30
  const files = await (0, crawler_1.crawl)(source);
29
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} chunk${chunks.length !== 1 ? 's' : ''} (max 2GB each)\n`);
32
- await (0, zipper_1.zipChunks)(chunks, outputDir, useTelegram, botToken, chatId);
33
+ console.log(`📦 Created ${chunks.length} chunk${chunks.length !== 1 ? 's' : ''} (max 48MB each)${password ? ' 🔒 Password protected' : ''}\n`);
34
+ await (0, zipper_1.zipChunks)(chunks, outputDir, useTelegram, botToken, chatId, password);
33
35
  console.log(`\n🎉 All done! ${useTelegram ? 'Files uploaded to Telegram.' : `Zips saved to ${outputDir}`}`);
34
36
  })();
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.chunkFiles = chunkFiles;
4
- const CHUNK_SIZE = 2 * 1024 * 1024 * 1024; // 2 GB
4
+ const CHUNK_SIZE = 48 * 1024 * 1024; // 48 MB
5
5
  // groups files into chunks where the total size of each chunk does not exceed CHUNK_SIZE
6
6
  function chunkFiles(files) {
7
7
  const chunks = [];
@@ -9,7 +9,8 @@ function chunkFiles(files) {
9
9
  let currentChunkSize = 0;
10
10
  for (const file of files) {
11
11
  if (file.size > CHUNK_SIZE) {
12
- throw new Error(`File ${file.path} exceeds the maximum chunk size of 2GB.`);
12
+ console.warn(`⚠️ Skipping file ${file.path} as it exceeds the maximum size of 48MB (${(file.size / (1024 * 1024)).toFixed(2)} MB).`);
13
+ continue;
13
14
  }
14
15
  if (currentChunkSize + file.size > CHUNK_SIZE) {
15
16
  chunks.push(currentChunk);
@@ -8,8 +8,12 @@ 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++) {
@@ -22,7 +26,14 @@ async function zipChunks(chunks, outputDir, useTelegram, botToken, chatId) {
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();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ayush24k/telezipper",
3
- "version": "1.2.0",
4
- "description": "Split folders into multiple 2GB zip files with optional Telegram upload made for personal use.",
3
+ "version": "1.4.0",
4
+ "description": "Split folders into multiple 50MB zip files with optional Telegram upload made for personal use.",
5
5
  "files": [
6
6
  "dist"
7
7
  ],
@@ -31,6 +31,7 @@
31
31
  "license": "ISC",
32
32
  "dependencies": {
33
33
  "archiver": "^7.0.1",
34
+ "archiver-zip-encrypted": "^2.0.0",
34
35
  "cli-progress": "^3.12.0",
35
36
  "commander": "^14.0.2",
36
37
  "dotenv": "^17.2.3",