converteverything-mcp 1.2.2 → 2.0.1
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 +233 -0
- package/dist/client.d.ts +72 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +280 -0
- package/dist/client.js.map +1 -1
- package/dist/index.js +590 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +99 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +9 -3
package/README.md
CHANGED
|
@@ -17,6 +17,10 @@ Tired of sketchy converter websites with popup ads and "premium" upsells? We bui
|
|
|
17
17
|
## Features
|
|
18
18
|
|
|
19
19
|
- **100+ Supported Formats**: Audio, video, image (including RAW camera formats), document, ebook, data, 3D, font, archive, and CAD files
|
|
20
|
+
- **File Compression**: Compress images, videos, and PDFs with quality presets
|
|
21
|
+
- **Archive Creation**: Create ZIP, TAR, 7z archives from multiple files
|
|
22
|
+
- **File Sharing**: Generate shareable links and send files via email
|
|
23
|
+
- **Cloud Import**: Import files from Google Drive, Dropbox, OneDrive, and Box
|
|
20
24
|
- **Simple Integration**: Works with Claude Desktop, Claude Code, and any MCP-compatible client
|
|
21
25
|
- **Conversion Options**: Fine-tune output quality, resolution, bitrate, and more
|
|
22
26
|
- **Secure**: Uses your personal API key, no data stored on third-party servers beyond conversion processing
|
|
@@ -421,6 +425,235 @@ Claude: [Uses estimate_output_size] Estimated output: ~15 MB (from 150 MB WAV at
|
|
|
421
425
|
- `options` (optional): Conversion options that affect size
|
|
422
426
|
- `preset` (optional): Preset name
|
|
423
427
|
|
|
428
|
+
---
|
|
429
|
+
|
|
430
|
+
## Compression Tools
|
|
431
|
+
|
|
432
|
+
### `compress_image`
|
|
433
|
+
|
|
434
|
+
Compress an image file to reduce file size.
|
|
435
|
+
|
|
436
|
+
```
|
|
437
|
+
User: Compress this photo to make it smaller for email
|
|
438
|
+
Claude: [Uses compress_image] Compressed from 5.2 MB to 1.1 MB (79% reduction)
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
**Parameters:**
|
|
442
|
+
- `file_path` (required): Path to the image file
|
|
443
|
+
- `quality` (optional): Quality level 1-100 (default: 80)
|
|
444
|
+
- `max_dimension` (optional): Max width/height in pixels
|
|
445
|
+
|
|
446
|
+
### `compress_video`
|
|
447
|
+
|
|
448
|
+
Compress a video file to reduce file size.
|
|
449
|
+
|
|
450
|
+
```
|
|
451
|
+
User: Make this video smaller for uploading
|
|
452
|
+
Claude: [Uses compress_video] Compressed from 500 MB to 85 MB
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
**Parameters:**
|
|
456
|
+
- `file_path` (required): Path to the video file
|
|
457
|
+
- `crf` (optional): Quality 0-51, lower is better (default: 28)
|
|
458
|
+
- `preset` (optional): Speed preset (ultrafast, fast, medium, slow)
|
|
459
|
+
- `max_resolution` (optional): Max resolution (e.g., "1920x1080", "720p")
|
|
460
|
+
- `remove_audio` (optional): Remove audio track
|
|
461
|
+
|
|
462
|
+
### `compress_pdf`
|
|
463
|
+
|
|
464
|
+
Compress a PDF file to reduce file size.
|
|
465
|
+
|
|
466
|
+
```
|
|
467
|
+
User: This PDF is too large to email, can you compress it?
|
|
468
|
+
Claude: [Uses compress_pdf] Compressed from 25 MB to 3.2 MB
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
**Parameters:**
|
|
472
|
+
- `file_path` (required): Path to the PDF file
|
|
473
|
+
- `quality` (optional): Quality level 1-100 (default: 80)
|
|
474
|
+
|
|
475
|
+
### `get_compression_usage`
|
|
476
|
+
|
|
477
|
+
Check your compression usage and limits.
|
|
478
|
+
|
|
479
|
+
```
|
|
480
|
+
User: How many compressions do I have left?
|
|
481
|
+
Claude: [Uses get_compression_usage] You've used 15 of 100 compressions today
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
---
|
|
485
|
+
|
|
486
|
+
## Archive Tools
|
|
487
|
+
|
|
488
|
+
### `create_archive`
|
|
489
|
+
|
|
490
|
+
Create an archive from multiple files.
|
|
491
|
+
|
|
492
|
+
```
|
|
493
|
+
User: Zip up all these project files
|
|
494
|
+
Claude: [Uses create_archive] Created project.zip with 12 files (45 MB)
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
**Parameters:**
|
|
498
|
+
- `file_paths` (required): Array of file paths to include
|
|
499
|
+
- `output_format` (optional): zip, tar, tar.gz, tar.bz2, or 7z (default: zip)
|
|
500
|
+
- `archive_name` (optional): Custom name for the archive
|
|
501
|
+
- `compression_level` (optional): 1-9 (default: 6)
|
|
502
|
+
|
|
503
|
+
---
|
|
504
|
+
|
|
505
|
+
## Advanced Conversion Tools
|
|
506
|
+
|
|
507
|
+
### `reconvert`
|
|
508
|
+
|
|
509
|
+
Re-run a previous conversion with different settings.
|
|
510
|
+
|
|
511
|
+
```
|
|
512
|
+
User: Can you redo that last conversion but with higher quality?
|
|
513
|
+
Claude: [Uses reconvert] Re-converting with quality set to 95...
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
**Parameters:**
|
|
517
|
+
- `conversion_id` (required): ID of the previous conversion
|
|
518
|
+
- `target_format` (optional): New target format
|
|
519
|
+
- `options` (optional): New conversion options
|
|
520
|
+
|
|
521
|
+
### `get_thumbnail`
|
|
522
|
+
|
|
523
|
+
Get a thumbnail preview for a conversion.
|
|
524
|
+
|
|
525
|
+
```
|
|
526
|
+
User: Show me a preview of that converted image
|
|
527
|
+
Claude: [Uses get_thumbnail] Here's a thumbnail preview...
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
**Parameters:**
|
|
531
|
+
- `conversion_id` (required): The conversion ID
|
|
532
|
+
- `save_path` (optional): Path to save the thumbnail
|
|
533
|
+
|
|
534
|
+
### `batch_convert_api`
|
|
535
|
+
|
|
536
|
+
True batch conversion using the API's batch endpoint (more efficient for large batches).
|
|
537
|
+
|
|
538
|
+
```
|
|
539
|
+
User: Convert all 50 of these files to PDF
|
|
540
|
+
Claude: [Uses batch_convert_api] Batch started with ID batch_abc123...
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
**Parameters:**
|
|
544
|
+
- `file_paths` (required): Array of file paths
|
|
545
|
+
- `target_format` (required): Target format for all files
|
|
546
|
+
- `options` (optional): Conversion options
|
|
547
|
+
|
|
548
|
+
### `get_batch_status`
|
|
549
|
+
|
|
550
|
+
Check the status of a batch conversion.
|
|
551
|
+
|
|
552
|
+
```
|
|
553
|
+
User: How's that batch conversion going?
|
|
554
|
+
Claude: [Uses get_batch_status] 45 of 50 complete, 5 still processing...
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
**Parameters:**
|
|
558
|
+
- `batch_id` (required): The batch ID
|
|
559
|
+
|
|
560
|
+
---
|
|
561
|
+
|
|
562
|
+
## File Sharing Tools
|
|
563
|
+
|
|
564
|
+
### `list_my_files`
|
|
565
|
+
|
|
566
|
+
List your shareable files.
|
|
567
|
+
|
|
568
|
+
```
|
|
569
|
+
User: What files do I have available to share?
|
|
570
|
+
Claude: [Uses list_my_files] You have 5 files ready to share...
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
**Parameters:**
|
|
574
|
+
- `page` (optional): Page number (default: 1)
|
|
575
|
+
- `per_page` (optional): Results per page (default: 20)
|
|
576
|
+
|
|
577
|
+
### `create_share_link`
|
|
578
|
+
|
|
579
|
+
Create a shareable download link for a file.
|
|
580
|
+
|
|
581
|
+
```
|
|
582
|
+
User: Generate a link I can share for that converted video
|
|
583
|
+
Claude: [Uses create_share_link] Here's your shareable link: https://converteverything.io/s/abc123
|
|
584
|
+
```
|
|
585
|
+
|
|
586
|
+
**Parameters:**
|
|
587
|
+
- `conversion_id` (required): The conversion ID
|
|
588
|
+
- `expires_hours` (optional): Hours until link expires (default: 24)
|
|
589
|
+
|
|
590
|
+
### `share_via_email`
|
|
591
|
+
|
|
592
|
+
Share a file directly via email.
|
|
593
|
+
|
|
594
|
+
```
|
|
595
|
+
User: Email that PDF to john@example.com
|
|
596
|
+
Claude: [Uses share_via_email] Email sent to john@example.com with download link
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
**Parameters:**
|
|
600
|
+
- `conversion_id` (required): The conversion ID
|
|
601
|
+
- `recipient_email` (required): Email address to send to
|
|
602
|
+
- `message` (optional): Custom message to include
|
|
603
|
+
|
|
604
|
+
---
|
|
605
|
+
|
|
606
|
+
## Cloud Import Tools
|
|
607
|
+
|
|
608
|
+
### `list_cloud_providers`
|
|
609
|
+
|
|
610
|
+
List available cloud storage providers.
|
|
611
|
+
|
|
612
|
+
```
|
|
613
|
+
User: What cloud services can I import from?
|
|
614
|
+
Claude: [Uses list_cloud_providers] You can import from Google Drive, Dropbox, OneDrive, and Box
|
|
615
|
+
```
|
|
616
|
+
|
|
617
|
+
### `list_cloud_connections`
|
|
618
|
+
|
|
619
|
+
List your connected cloud storage accounts.
|
|
620
|
+
|
|
621
|
+
```
|
|
622
|
+
User: What cloud accounts do I have connected?
|
|
623
|
+
Claude: [Uses list_cloud_connections] You have Google Drive (user@gmail.com) connected
|
|
624
|
+
```
|
|
625
|
+
|
|
626
|
+
### `list_cloud_files`
|
|
627
|
+
|
|
628
|
+
Browse files in a connected cloud storage account.
|
|
629
|
+
|
|
630
|
+
```
|
|
631
|
+
User: Show me the files in my Google Drive
|
|
632
|
+
Claude: [Uses list_cloud_files] Here are your Google Drive files...
|
|
633
|
+
```
|
|
634
|
+
|
|
635
|
+
**Parameters:**
|
|
636
|
+
- `connection_id` (required): Cloud connection ID
|
|
637
|
+
- `folder_id` (optional): Folder to browse (root if not specified)
|
|
638
|
+
- `page_token` (optional): For pagination
|
|
639
|
+
|
|
640
|
+
### `import_from_cloud`
|
|
641
|
+
|
|
642
|
+
Import a file from cloud storage for conversion.
|
|
643
|
+
|
|
644
|
+
```
|
|
645
|
+
User: Import that video from my Dropbox and convert it to MP4
|
|
646
|
+
Claude: [Uses import_from_cloud, then convert_file] Importing and converting...
|
|
647
|
+
```
|
|
648
|
+
|
|
649
|
+
**Parameters:**
|
|
650
|
+
- `connection_id` (required): Cloud connection ID
|
|
651
|
+
- `file_id` (required): Cloud file ID
|
|
652
|
+
- `target_format` (optional): Convert immediately after import
|
|
653
|
+
- `options` (optional): Conversion options (if converting)
|
|
654
|
+
|
|
655
|
+
---
|
|
656
|
+
|
|
424
657
|
## Conversion Presets
|
|
425
658
|
|
|
426
659
|
Presets provide pre-configured conversion settings optimized for different use cases. Use them with the `preset` parameter in `convert_file`, `convert_base64`, or `batch_convert`.
|
package/dist/client.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Secure client for interacting with the ConvertEverything.io public API.
|
|
5
5
|
* Only uses documented public endpoints - no internal/admin access.
|
|
6
6
|
*/
|
|
7
|
-
import { ClientConfig, ConversionResponse, ConversionListResponse, ConversionOptions, SupportedFormatsResponse, UsageResponse } from "./types.js";
|
|
7
|
+
import { ClientConfig, ConversionResponse, ConversionListResponse, ConversionOptions, SupportedFormatsResponse, UsageResponse, CompressionOptions, CompressionUsageResponse, ArchiveOptions, BatchResponse, MyFilesResponse, ShareableLinkResponse, ShareEmailResponse, CloudProvider, CloudProvidersResponse, CloudConnectionsResponse, CloudFileListResponse, CloudImportResponse } from "./types.js";
|
|
8
8
|
export interface WaitOptions {
|
|
9
9
|
pollInterval?: number;
|
|
10
10
|
timeout?: number;
|
|
@@ -117,6 +117,77 @@ export declare class ConvertEverythingClient {
|
|
|
117
117
|
* Retry a failed conversion with optional new options
|
|
118
118
|
*/
|
|
119
119
|
retryConversion(conversionId: string, newOptions?: ConversionOptions): Promise<ConversionResponse>;
|
|
120
|
+
/**
|
|
121
|
+
* Compress an image file
|
|
122
|
+
*/
|
|
123
|
+
compressImage(filePath: string, options?: CompressionOptions): Promise<ConversionResponse>;
|
|
124
|
+
/**
|
|
125
|
+
* Compress a video file
|
|
126
|
+
*/
|
|
127
|
+
compressVideo(filePath: string, options?: CompressionOptions): Promise<ConversionResponse>;
|
|
128
|
+
/**
|
|
129
|
+
* Compress a PDF file
|
|
130
|
+
*/
|
|
131
|
+
compressPdf(filePath: string, quality?: "low" | "medium" | "high"): Promise<ConversionResponse>;
|
|
132
|
+
/**
|
|
133
|
+
* Get compression usage statistics
|
|
134
|
+
*/
|
|
135
|
+
getCompressionUsage(): Promise<CompressionUsageResponse>;
|
|
136
|
+
/**
|
|
137
|
+
* Create an archive from multiple files
|
|
138
|
+
*/
|
|
139
|
+
createArchive(filePaths: string[], options?: ArchiveOptions): Promise<ConversionResponse>;
|
|
140
|
+
/**
|
|
141
|
+
* Reconvert an existing conversion with new settings
|
|
142
|
+
*/
|
|
143
|
+
reconvert(conversionId: string, targetFormat: string, options?: ConversionOptions): Promise<ConversionResponse>;
|
|
144
|
+
/**
|
|
145
|
+
* Get thumbnail for a conversion
|
|
146
|
+
*/
|
|
147
|
+
getThumbnail(conversionId: string): Promise<{
|
|
148
|
+
data: Buffer;
|
|
149
|
+
contentType: string;
|
|
150
|
+
}>;
|
|
151
|
+
/**
|
|
152
|
+
* Use the true batch API endpoint
|
|
153
|
+
*/
|
|
154
|
+
batchConvert(filePaths: string[], targetFormat: string, options?: ConversionOptions): Promise<BatchResponse>;
|
|
155
|
+
/**
|
|
156
|
+
* Get batch status
|
|
157
|
+
*/
|
|
158
|
+
getBatchStatus(batchId: string): Promise<BatchResponse>;
|
|
159
|
+
/**
|
|
160
|
+
* List user's shareable files
|
|
161
|
+
*/
|
|
162
|
+
listMyFiles(page?: number, perPage?: number): Promise<MyFilesResponse>;
|
|
163
|
+
/**
|
|
164
|
+
* Create a shareable link for a conversion
|
|
165
|
+
*/
|
|
166
|
+
createShareLink(conversionId: string): Promise<ShareableLinkResponse>;
|
|
167
|
+
/**
|
|
168
|
+
* Share a file via email
|
|
169
|
+
*/
|
|
170
|
+
shareViaEmail(shortId: string, recipientEmail: string, message?: string): Promise<ShareEmailResponse>;
|
|
171
|
+
/**
|
|
172
|
+
* List available cloud providers for user's tier
|
|
173
|
+
*/
|
|
174
|
+
listCloudProviders(): Promise<CloudProvidersResponse>;
|
|
175
|
+
/**
|
|
176
|
+
* List connected cloud accounts
|
|
177
|
+
*/
|
|
178
|
+
listCloudConnections(): Promise<CloudConnectionsResponse>;
|
|
179
|
+
/**
|
|
180
|
+
* List files from a connected cloud provider
|
|
181
|
+
*/
|
|
182
|
+
listCloudFiles(provider: CloudProvider, folderId?: string, pageToken?: string): Promise<CloudFileListResponse>;
|
|
183
|
+
/**
|
|
184
|
+
* Import a file from cloud storage
|
|
185
|
+
*/
|
|
186
|
+
importFromCloud(provider: CloudProvider, fileId: string, fileName: string): Promise<CloudImportResponse>;
|
|
187
|
+
/**
|
|
188
|
+
* Import from cloud and convert in one step
|
|
189
|
+
*/
|
|
190
|
+
importAndConvert(provider: CloudProvider, fileId: string, fileName: string, targetFormat: string, options?: ConversionOptions): Promise<ConversionResponse>;
|
|
120
191
|
/**
|
|
121
192
|
* Validate UUID format
|
|
122
193
|
*/
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,sBAAsB,EACtB,iBAAiB,EACjB,wBAAwB,EACxB,aAAa,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,sBAAsB,EACtB,iBAAiB,EACjB,wBAAwB,EACxB,aAAa,EAKb,kBAAkB,EAClB,wBAAwB,EACxB,cAAc,EACd,aAAa,EACb,eAAe,EACf,qBAAqB,EACrB,kBAAkB,EAClB,aAAa,EACb,sBAAsB,EACtB,wBAAwB,EACxB,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,WAAW;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,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,OAAO,CAAC,sBAAsB,CAAC;IAI3D;;OAEG;IACG,oBAAoB,IAAI,OAAO,CAAC,wBAAwB,CAAC;IAI/D;;OAEG;IACG,cAAc,CAClB,QAAQ,EAAE,aAAa,EACvB,QAAQ,CAAC,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,qBAAqB,CAAC;IAcjC;;OAEG;IACG,eAAe,CACnB,QAAQ,EAAE,aAAa,EACvB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,mBAAmB,CAAC;IAY/B;;OAEG;IACG,gBAAgB,CACpB,QAAQ,EAAE,aAAa,EACvB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,kBAAkB,CAAC;IAc9B;;OAEG;IACH,OAAO,CAAC,WAAW;IAMnB;;OAEG;IACH,OAAO,CAAC,gBAAgB;CAqBzB"}
|
package/dist/client.js
CHANGED
|
@@ -562,6 +562,286 @@ class ConvertEverythingClient {
|
|
|
562
562
|
`(${original.original_filename}) and convert to ${original.target_format} again. ` +
|
|
563
563
|
`Original error: ${original.error_message || "Unknown"}`);
|
|
564
564
|
}
|
|
565
|
+
// ==========================================================================
|
|
566
|
+
// Compression Methods
|
|
567
|
+
// ==========================================================================
|
|
568
|
+
/**
|
|
569
|
+
* Compress an image file
|
|
570
|
+
*/
|
|
571
|
+
async compressImage(filePath, options) {
|
|
572
|
+
const realPath = this.validateFilePath(filePath);
|
|
573
|
+
const fileBuffer = fs.readFileSync(realPath);
|
|
574
|
+
const fileName = path.basename(realPath);
|
|
575
|
+
const formData = new FormData();
|
|
576
|
+
const blob = new Blob([fileBuffer]);
|
|
577
|
+
formData.append("file", blob, this.sanitizeFilename(fileName));
|
|
578
|
+
if (options?.quality !== undefined) {
|
|
579
|
+
formData.append("quality", options.quality.toString());
|
|
580
|
+
}
|
|
581
|
+
if (options?.max_dimension !== undefined) {
|
|
582
|
+
formData.append("max_dimension", options.max_dimension.toString());
|
|
583
|
+
}
|
|
584
|
+
return this.request("/tools/compress/image", {
|
|
585
|
+
method: "POST",
|
|
586
|
+
body: formData,
|
|
587
|
+
});
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* Compress a video file
|
|
591
|
+
*/
|
|
592
|
+
async compressVideo(filePath, options) {
|
|
593
|
+
const realPath = this.validateFilePath(filePath);
|
|
594
|
+
const fileBuffer = fs.readFileSync(realPath);
|
|
595
|
+
const fileName = path.basename(realPath);
|
|
596
|
+
const formData = new FormData();
|
|
597
|
+
const blob = new Blob([fileBuffer]);
|
|
598
|
+
formData.append("file", blob, this.sanitizeFilename(fileName));
|
|
599
|
+
if (options?.crf !== undefined) {
|
|
600
|
+
formData.append("crf", options.crf.toString());
|
|
601
|
+
}
|
|
602
|
+
if (options?.preset) {
|
|
603
|
+
formData.append("preset", options.preset);
|
|
604
|
+
}
|
|
605
|
+
if (options?.max_resolution) {
|
|
606
|
+
formData.append("max_resolution", options.max_resolution);
|
|
607
|
+
}
|
|
608
|
+
if (options?.remove_audio !== undefined) {
|
|
609
|
+
formData.append("remove_audio", options.remove_audio.toString());
|
|
610
|
+
}
|
|
611
|
+
return this.request("/tools/compress/video", {
|
|
612
|
+
method: "POST",
|
|
613
|
+
body: formData,
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
/**
|
|
617
|
+
* Compress a PDF file
|
|
618
|
+
*/
|
|
619
|
+
async compressPdf(filePath, quality) {
|
|
620
|
+
const realPath = this.validateFilePath(filePath);
|
|
621
|
+
const fileBuffer = fs.readFileSync(realPath);
|
|
622
|
+
const fileName = path.basename(realPath);
|
|
623
|
+
const formData = new FormData();
|
|
624
|
+
const blob = new Blob([fileBuffer]);
|
|
625
|
+
formData.append("file", blob, this.sanitizeFilename(fileName));
|
|
626
|
+
if (quality) {
|
|
627
|
+
formData.append("quality", quality);
|
|
628
|
+
}
|
|
629
|
+
return this.request("/tools/compress/pdf", {
|
|
630
|
+
method: "POST",
|
|
631
|
+
body: formData,
|
|
632
|
+
});
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
635
|
+
* Get compression usage statistics
|
|
636
|
+
*/
|
|
637
|
+
async getCompressionUsage() {
|
|
638
|
+
return this.request("/tools/compress/usage");
|
|
639
|
+
}
|
|
640
|
+
// ==========================================================================
|
|
641
|
+
// Archive Methods
|
|
642
|
+
// ==========================================================================
|
|
643
|
+
/**
|
|
644
|
+
* Create an archive from multiple files
|
|
645
|
+
*/
|
|
646
|
+
async createArchive(filePaths, options) {
|
|
647
|
+
const formData = new FormData();
|
|
648
|
+
for (const filePath of filePaths) {
|
|
649
|
+
const realPath = this.validateFilePath(filePath);
|
|
650
|
+
const fileBuffer = fs.readFileSync(realPath);
|
|
651
|
+
const fileName = path.basename(realPath);
|
|
652
|
+
const blob = new Blob([fileBuffer]);
|
|
653
|
+
formData.append("files", blob, this.sanitizeFilename(fileName));
|
|
654
|
+
}
|
|
655
|
+
if (options?.output_format) {
|
|
656
|
+
formData.append("output_format", options.output_format);
|
|
657
|
+
}
|
|
658
|
+
if (options?.archive_name) {
|
|
659
|
+
formData.append("archive_name", options.archive_name);
|
|
660
|
+
}
|
|
661
|
+
if (options?.compression_level !== undefined) {
|
|
662
|
+
formData.append("compression_level", options.compression_level.toString());
|
|
663
|
+
}
|
|
664
|
+
return this.request("/tools/create-archive", {
|
|
665
|
+
method: "POST",
|
|
666
|
+
body: formData,
|
|
667
|
+
});
|
|
668
|
+
}
|
|
669
|
+
// ==========================================================================
|
|
670
|
+
// Advanced Conversion Methods
|
|
671
|
+
// ==========================================================================
|
|
672
|
+
/**
|
|
673
|
+
* Reconvert an existing conversion with new settings
|
|
674
|
+
*/
|
|
675
|
+
async reconvert(conversionId, targetFormat, options) {
|
|
676
|
+
if (!this.isValidUuid(conversionId)) {
|
|
677
|
+
throw new Error("Invalid conversion ID format");
|
|
678
|
+
}
|
|
679
|
+
const normalizedFormat = targetFormat.toLowerCase().replace(/^\./, "");
|
|
680
|
+
const body = {
|
|
681
|
+
output_format: normalizedFormat,
|
|
682
|
+
};
|
|
683
|
+
if (options && Object.keys(options).length > 0) {
|
|
684
|
+
body.options = options;
|
|
685
|
+
}
|
|
686
|
+
return this.request(`/convert/${conversionId}/reconvert`, {
|
|
687
|
+
method: "POST",
|
|
688
|
+
headers: { "Content-Type": "application/json" },
|
|
689
|
+
body: JSON.stringify(body),
|
|
690
|
+
});
|
|
691
|
+
}
|
|
692
|
+
/**
|
|
693
|
+
* Get thumbnail for a conversion
|
|
694
|
+
*/
|
|
695
|
+
async getThumbnail(conversionId) {
|
|
696
|
+
if (!this.isValidUuid(conversionId)) {
|
|
697
|
+
throw new Error("Invalid conversion ID format");
|
|
698
|
+
}
|
|
699
|
+
const url = `${this.baseUrl}/api/convert/${conversionId}/thumbnail`;
|
|
700
|
+
const correlationId = this.generateCorrelationId();
|
|
701
|
+
const response = await this.fetchWithRetry(url, {
|
|
702
|
+
headers: {
|
|
703
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
704
|
+
"User-Agent": this.userAgent,
|
|
705
|
+
},
|
|
706
|
+
}, correlationId);
|
|
707
|
+
if (!response.ok) {
|
|
708
|
+
throw new Error(`Failed to get thumbnail: ${response.status} ${response.statusText}`);
|
|
709
|
+
}
|
|
710
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
711
|
+
const buffer = Buffer.from(arrayBuffer);
|
|
712
|
+
const contentType = response.headers.get("Content-Type") || "image/jpeg";
|
|
713
|
+
return { data: buffer, contentType };
|
|
714
|
+
}
|
|
715
|
+
/**
|
|
716
|
+
* Use the true batch API endpoint
|
|
717
|
+
*/
|
|
718
|
+
async batchConvert(filePaths, targetFormat, options) {
|
|
719
|
+
const normalizedFormat = targetFormat.toLowerCase().replace(/^\./, "");
|
|
720
|
+
if (!(0, types_js_1.isFormatSupported)(normalizedFormat)) {
|
|
721
|
+
throw new Error(`Unsupported target format: ${targetFormat}`);
|
|
722
|
+
}
|
|
723
|
+
const formData = new FormData();
|
|
724
|
+
for (const filePath of filePaths) {
|
|
725
|
+
const realPath = this.validateFilePath(filePath);
|
|
726
|
+
const fileBuffer = fs.readFileSync(realPath);
|
|
727
|
+
const fileName = path.basename(realPath);
|
|
728
|
+
const blob = new Blob([fileBuffer]);
|
|
729
|
+
formData.append("files", blob, this.sanitizeFilename(fileName));
|
|
730
|
+
}
|
|
731
|
+
formData.append("output_format", normalizedFormat);
|
|
732
|
+
if (options && Object.keys(options).length > 0) {
|
|
733
|
+
formData.append("options", JSON.stringify(options));
|
|
734
|
+
}
|
|
735
|
+
return this.request("/convert/batch", {
|
|
736
|
+
method: "POST",
|
|
737
|
+
body: formData,
|
|
738
|
+
});
|
|
739
|
+
}
|
|
740
|
+
/**
|
|
741
|
+
* Get batch status
|
|
742
|
+
*/
|
|
743
|
+
async getBatchStatus(batchId) {
|
|
744
|
+
if (!this.isValidUuid(batchId)) {
|
|
745
|
+
throw new Error("Invalid batch ID format");
|
|
746
|
+
}
|
|
747
|
+
return this.request(`/convert/batch/${batchId}`);
|
|
748
|
+
}
|
|
749
|
+
// ==========================================================================
|
|
750
|
+
// File Sharing Methods
|
|
751
|
+
// ==========================================================================
|
|
752
|
+
/**
|
|
753
|
+
* List user's shareable files
|
|
754
|
+
*/
|
|
755
|
+
async listMyFiles(page = 1, perPage = 20) {
|
|
756
|
+
const skip = (page - 1) * perPage;
|
|
757
|
+
return this.request(`/files/my-files?skip=${skip}&limit=${perPage}`);
|
|
758
|
+
}
|
|
759
|
+
/**
|
|
760
|
+
* Create a shareable link for a conversion
|
|
761
|
+
*/
|
|
762
|
+
async createShareLink(conversionId) {
|
|
763
|
+
if (!this.isValidUuid(conversionId)) {
|
|
764
|
+
throw new Error("Invalid conversion ID format");
|
|
765
|
+
}
|
|
766
|
+
return this.request("/files/create", {
|
|
767
|
+
method: "POST",
|
|
768
|
+
headers: { "Content-Type": "application/json" },
|
|
769
|
+
body: JSON.stringify({ conversion_id: conversionId }),
|
|
770
|
+
});
|
|
771
|
+
}
|
|
772
|
+
/**
|
|
773
|
+
* Share a file via email
|
|
774
|
+
*/
|
|
775
|
+
async shareViaEmail(shortId, recipientEmail, message) {
|
|
776
|
+
const body = {
|
|
777
|
+
recipient_email: recipientEmail,
|
|
778
|
+
};
|
|
779
|
+
if (message) {
|
|
780
|
+
body.message = message;
|
|
781
|
+
}
|
|
782
|
+
return this.request(`/files/d/${shortId}/share-email`, {
|
|
783
|
+
method: "POST",
|
|
784
|
+
headers: { "Content-Type": "application/json" },
|
|
785
|
+
body: JSON.stringify(body),
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
// ==========================================================================
|
|
789
|
+
// Cloud Import Methods
|
|
790
|
+
// ==========================================================================
|
|
791
|
+
/**
|
|
792
|
+
* List available cloud providers for user's tier
|
|
793
|
+
*/
|
|
794
|
+
async listCloudProviders() {
|
|
795
|
+
return this.request("/cloud/providers");
|
|
796
|
+
}
|
|
797
|
+
/**
|
|
798
|
+
* List connected cloud accounts
|
|
799
|
+
*/
|
|
800
|
+
async listCloudConnections() {
|
|
801
|
+
return this.request("/cloud/connections");
|
|
802
|
+
}
|
|
803
|
+
/**
|
|
804
|
+
* List files from a connected cloud provider
|
|
805
|
+
*/
|
|
806
|
+
async listCloudFiles(provider, folderId, pageToken) {
|
|
807
|
+
let url = `/cloud/files/${provider}`;
|
|
808
|
+
const params = [];
|
|
809
|
+
if (folderId)
|
|
810
|
+
params.push(`folder_id=${encodeURIComponent(folderId)}`);
|
|
811
|
+
if (pageToken)
|
|
812
|
+
params.push(`page_token=${encodeURIComponent(pageToken)}`);
|
|
813
|
+
if (params.length > 0) {
|
|
814
|
+
url += `?${params.join("&")}`;
|
|
815
|
+
}
|
|
816
|
+
return this.request(url);
|
|
817
|
+
}
|
|
818
|
+
/**
|
|
819
|
+
* Import a file from cloud storage
|
|
820
|
+
*/
|
|
821
|
+
async importFromCloud(provider, fileId, fileName) {
|
|
822
|
+
return this.request("/cloud/import", {
|
|
823
|
+
method: "POST",
|
|
824
|
+
headers: { "Content-Type": "application/json" },
|
|
825
|
+
body: JSON.stringify({
|
|
826
|
+
provider,
|
|
827
|
+
file_id: fileId,
|
|
828
|
+
file_name: fileName,
|
|
829
|
+
}),
|
|
830
|
+
});
|
|
831
|
+
}
|
|
832
|
+
/**
|
|
833
|
+
* Import from cloud and convert in one step
|
|
834
|
+
*/
|
|
835
|
+
async importAndConvert(provider, fileId, fileName, targetFormat, options) {
|
|
836
|
+
// First import the file
|
|
837
|
+
const imported = await this.importFromCloud(provider, fileId, fileName);
|
|
838
|
+
// The imported file is now in temporary storage, we need to convert it
|
|
839
|
+
// Note: This requires the backend to support conversion from imported files
|
|
840
|
+
// For now, we return the import result and user can convert separately
|
|
841
|
+
throw new Error(`File imported successfully as ${imported.object_name}. ` +
|
|
842
|
+
`Direct import-and-convert is not yet supported. ` +
|
|
843
|
+
`Please download the file and use convert_file instead.`);
|
|
844
|
+
}
|
|
565
845
|
/**
|
|
566
846
|
* Validate UUID format
|
|
567
847
|
*/
|