grab-url 0.9.136 → 0.9.138
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/package.json +1 -1
- package/src/grab-url-cli.js +18 -21
package/package.json
CHANGED
package/src/grab-url-cli.js
CHANGED
|
@@ -175,15 +175,15 @@ cleanupStateFile(stateFilePath) {
|
|
|
175
175
|
*/
|
|
176
176
|
printHeaderRow() {
|
|
177
177
|
console.log(
|
|
178
|
-
this.colors.success('
|
|
179
|
-
this.colors.yellow('
|
|
180
|
-
this.colors.cyan('
|
|
178
|
+
this.colors.success('%'.padEnd(this.COL_PERCENT)) +
|
|
179
|
+
this.colors.yellow('File'.padEnd(this.COL_FILENAME)) +
|
|
180
|
+
this.colors.cyan(''.padEnd(this.COL_SPINNER)) +
|
|
181
181
|
' ' +
|
|
182
|
-
this.colors.green('
|
|
183
|
-
this.colors.info('
|
|
184
|
-
this.colors.info('
|
|
185
|
-
this.colors.purple('
|
|
186
|
-
this.colors.pink('
|
|
182
|
+
this.colors.green('Progress'.padEnd(this.COL_BAR + 1)) +
|
|
183
|
+
this.colors.info('Downloaded'.padEnd(this.COL_DOWNLOADED)) +
|
|
184
|
+
this.colors.info('Total'.padEnd(this.COL_TOTAL)) +
|
|
185
|
+
this.colors.purple('Speed'.padEnd(this.COL_SPEED)) +
|
|
186
|
+
this.colors.pink('ETA'.padEnd(this.COL_ETA))
|
|
187
187
|
);
|
|
188
188
|
}
|
|
189
189
|
|
|
@@ -621,16 +621,16 @@ formatTotalSpeed(bytesPerSecond) {
|
|
|
621
621
|
*/
|
|
622
622
|
async downloadMultipleFiles(downloads) {
|
|
623
623
|
try {
|
|
624
|
-
console.log(this.colors.primary(
|
|
624
|
+
console.log(this.colors.primary(`Starting ${downloads.length} downloads...\n`));
|
|
625
625
|
|
|
626
626
|
// Set up global keyboard listener for pause/resume and add URL BEFORE starting downloads
|
|
627
627
|
this.setupGlobalKeyboardListener();
|
|
628
628
|
|
|
629
|
-
// Print header row
|
|
629
|
+
// Print header row
|
|
630
630
|
this.printHeaderRow();
|
|
631
631
|
|
|
632
|
-
// Show keyboard
|
|
633
|
-
console.log(this.colors.info('
|
|
632
|
+
// Show keyboard shortcuts
|
|
633
|
+
console.log(this.colors.info('Press p to pause/resume, a to add URL'));
|
|
634
634
|
|
|
635
635
|
// Get random colors for the multibar
|
|
636
636
|
const masterBarColor = this.getRandomBarColor();
|
|
@@ -857,23 +857,20 @@ async downloadMultipleFiles(downloads) {
|
|
|
857
857
|
const successful = results.filter(r => r.status === 'fulfilled' && r.value.success).length;
|
|
858
858
|
const failed = results.length - successful;
|
|
859
859
|
|
|
860
|
-
console.log(this.colors.green(
|
|
860
|
+
console.log(this.colors.green(`Success: ${successful}/${downloads.length}`));
|
|
861
861
|
if (failed > 0) {
|
|
862
|
-
console.log(this.colors.error(
|
|
862
|
+
console.log(this.colors.error(`Failed: ${failed}/${downloads.length}`));
|
|
863
863
|
|
|
864
864
|
results.forEach((result, index) => {
|
|
865
865
|
if (result.status === 'rejected' || !result.value.success) {
|
|
866
866
|
const filename = downloads[index].filename;
|
|
867
867
|
const error = result.reason || result.value?.error || 'Unknown error';
|
|
868
|
-
console.log(this.colors.error(`
|
|
868
|
+
console.log(this.colors.error(` ${filename}: ${error.message || error}`));
|
|
869
869
|
}
|
|
870
870
|
});
|
|
871
871
|
}
|
|
872
872
|
|
|
873
|
-
|
|
874
|
-
const celebrationEmojis = ['🥳', '🎊', '🎈', '🌟', '💯', '🚀', '✨', '🔥'];
|
|
875
|
-
const randomEmoji = celebrationEmojis[Math.floor(Math.random() * celebrationEmojis.length)];
|
|
876
|
-
console.log(this.colors.success(`${randomEmoji} Batch download completed! ${randomEmoji}`));
|
|
873
|
+
console.log(this.colors.success('Download completed'));
|
|
877
874
|
|
|
878
875
|
this.clearAbortControllers();
|
|
879
876
|
|
|
@@ -2031,8 +2028,8 @@ console.error(chalk.red('Reason: ') + reason);
|
|
|
2031
2028
|
process.exit(1);
|
|
2032
2029
|
});
|
|
2033
2030
|
|
|
2034
|
-
// Run the CLI if
|
|
2035
|
-
if (
|
|
2031
|
+
// Run the CLI if there are command line arguments (indicating it's being run as a CLI tool)
|
|
2032
|
+
if (process.argv.length > 2) {
|
|
2036
2033
|
main().catch((error) => {
|
|
2037
2034
|
console.error(chalk.red.bold('💥 Fatal error: ') + error.message);
|
|
2038
2035
|
process.exit(1);
|