@ayush24k/telezipper 1.2.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 +23 -0
- package/dist/bin/zipper.js +4 -2
- package/dist/src/zipper.js +13 -2
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -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
|
|
@@ -121,6 +143,7 @@ telezipper ./my-project --telegram
|
|
|
121
143
|
|
|
122
144
|
- ✅ Automatically splits large folders into 2GB 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)
|
package/dist/bin/zipper.js
CHANGED
|
@@ -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 2GB 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
|
})();
|
package/dist/src/zipper.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ayush24k/telezipper",
|
|
3
|
-
"version": "1.
|
|
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"
|
|
@@ -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",
|