Comparing version 0.4.0 to 0.5.0
#!/usr/bin/env node | ||
import{a as r,b,c as w}from"./chunk-AMIM6PVT.js";import x from"cli-progress";import y from"meow";import $ from"fs";import S from"path";import m from"chalk";var c=y(` | ||
USAGE | ||
import{a as r,b,c as w}from"./chunk-TDJJNDZB.js";import x from"cli-progress";import y from"meow";import $ from"fs";import S from"path";import m from"chalk";var c=y(`USAGE | ||
$ imgdl <url> ... [OPTIONS] | ||
@@ -5,0 +4,0 @@ |
@@ -1,2 +0,2 @@ | ||
import{c as a}from"./chunk-AMIM6PVT.js";export{a as default}; | ||
import{c as a}from"./chunk-TDJJNDZB.js";export{a as default}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "img-dl", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "Download image(s), by command or programmatically", | ||
@@ -15,4 +15,4 @@ "type": "module", | ||
"scripts": { | ||
"lint": "eslint .", | ||
"lint:fix": "eslint . --fix", | ||
"lint": "eslint . && prettier --check .", | ||
"lint:fix": "eslint . --fix && prettier --write .", | ||
"test": "vitest run", | ||
@@ -44,13 +44,14 @@ "test:watch": "vitest", | ||
"devDependencies": { | ||
"@eslint/js": "^9.2.0", | ||
"@types/cli-progress": "^3.11.5", | ||
"@types/node": "^20.10.4", | ||
"@typescript-eslint/eslint-plugin": "^6.13.2", | ||
"@typescript-eslint/parser": "^6.13.2", | ||
"@vitest/coverage-v8": "^1.0.2", | ||
"eslint": "^8.55.0", | ||
"eslint-config-airbnb-typescript": "^17.1.0", | ||
"@types/node": "^20.12.8", | ||
"@vitest/coverage-v8": "^1.6.0", | ||
"eslint": "^8.57.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"execa": "^8.0.1", | ||
"tsup": "^8.0.1", | ||
"typescript": "^5.3.3", | ||
"vitest": "^1.0.2" | ||
"prettier": "^3.2.5", | ||
"tsup": "^8.0.2", | ||
"typescript": "^5.4.5", | ||
"typescript-eslint": "^7.8.0", | ||
"vitest": "^1.6.0" | ||
}, | ||
@@ -61,6 +62,6 @@ "dependencies": { | ||
"got": "^13.0.0", | ||
"meow": "^12.1.1", | ||
"p-queue": "^7.4.1", | ||
"meow": "^13.2.0", | ||
"p-queue": "^8.0.1", | ||
"sanitize-filename": "^1.6.3" | ||
} | ||
} |
112
README.md
@@ -10,3 +10,2 @@ # img-dl | ||
## Prerequisites | ||
@@ -144,30 +143,95 @@ | ||
| Properties | Type | Default | Description | | ||
| --- | --- | --- | --- | | ||
| `directory` | `string` | `process.cwd()` | The output directory | | ||
| `extension` | `string` | jpg | The file extension. If not specified, the original extension will be used. If the original extension is not available, 'jpg' will be used. | | ||
| `headers` | `Record<string, string \| string[] \| undefined>` | `undefined` | The headers to send with the request. | | ||
| `interval` | `number` | 100 | The interval between each batch of requests in milliseconds when downloading multiple images. | | ||
| `name` | `string` | image | The filename. If not specified, the original filename will be used. If the original filename is not available, 'image' will be used. <br>When downloading multiple images, `-index` will be appended to the end of the name (suffix). `index` will start from 1. For example: 'image-1' | | ||
| `maxRetry` | `number` | 2 | Set the maximum number of times to retry the request if it fails. | ||
| `onSuccess` | `(image: Image) => void` | `undefined` | The callback function to be called when the image is successfully downloaded. Only available when downloading multiple images. | | ||
| `onError` | `(error: Error, url: string) => void` | `undefined` | The callback function to be called when the image fails to download. Only available when downloading multiple images. | | ||
| `signal` | `AbortSignal \| undefined` | The signal to abort the request. | | ||
| `step` | `number` | 5 | The number of requests to make at the same time when downloading multiple images. | | ||
| `timeout` | `number` | `undefined` | Set timeout for each request in milliseconds. | ||
##### `directory` | ||
Type: `string`<br> | ||
Default: `process.cwd()` | ||
The output directory. | ||
##### `extension` | ||
Type: `string`<br> | ||
Default: `'jpg'` | ||
The file extension. If not specified, the original extension will be used. If the original extension is not available, 'jpg' will be used. | ||
##### `headers` | ||
Type: `Record<string, string | string[] | undefined>`<br> | ||
Default: `undefined` | ||
The headers to send with the request. | ||
##### `interval` | ||
Type: `number`<br> | ||
Default: `100` | ||
The interval between each batch of requests in milliseconds when downloading multiple images. | ||
##### `name` | ||
Type: `string`<br> | ||
Default: `'image'` | ||
The filename. If not specified, the original filename will be used. If the original filename is not available, 'image' will be used. <br>When downloading multiple images, `-index` will be appended to the end of the name (suffix). `index` will start from 1. For example: 'image-1' | ||
##### `maxRetry` | ||
Type: `number`<br> | ||
Default: `2` | ||
Set the maximum number of times to retry the request if it fails. | ||
##### `onSuccess` | ||
Type: `(image: Image) => void`<br> | ||
Default: `undefined` | ||
The callback function to be called when the image is successfully downloaded. Only available when downloading multiple images. | ||
##### `onError` | ||
Type: `(error: Error, url: string) => void`<br> | ||
Default: `undefined` | ||
The callback function to be called when the image fails to download. Only available when downloading multiple images. | ||
##### `signal` | ||
Type: `AbortSignal`<br> | ||
Default: `undefined` | ||
The signal to abort the request. | ||
##### `step` | ||
Type: `number`<br> | ||
Default: `5` | ||
The number of requests to make at the same time when downloading multiple images. | ||
##### `timeout` | ||
Type: `number`<br> | ||
Default: `undefined` | ||
Set timeout for each request in milliseconds. | ||
## Comparison | ||
| Features | **img-dl** | [image-downloader][p1] | | ||
| --- | :---: | :---: | | ||
| Download single image | ✅ | ✅ | | ||
| Download multiple images | ✅ | ❌ | | ||
| CLI | ✅ | ❌ | | ||
| Increment download | ✅ | ❌ | | ||
| Custom filename | ✅ | ✅ | | ||
| Custom extension | ✅ | ❌ | | ||
| Request timeout | ✅ | ✅ | | ||
| Retry failed request | ✅ | ❌ | | ||
| Features | **img-dl** | [image-downloader][p1] | | ||
| ------------------------ | :--------: | :--------------------: | | ||
| Download single image | ✅ | ✅ | | ||
| Download multiple images | ✅ | ❌ | | ||
| CLI | ✅ | ❌ | | ||
| Increment download | ✅ | ❌ | | ||
| Custom filename | ✅ | ✅ | | ||
| Custom extension | ✅ | ❌ | | ||
| Request timeout | ✅ | ✅ | | ||
| Retry failed request | ✅ | ❌ | | ||
| Abort request | ✅ | ❌ | | ||
<!-- Project links --> | ||
[p1]: https://www.npmjs.com/package/image-downloader | ||
@@ -174,0 +238,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48614
242
12
187
+ Addedmeow@13.2.0(transitive)
+ Addedp-queue@8.0.1(transitive)
+ Addedp-timeout@6.1.3(transitive)
- Removedmeow@12.1.1(transitive)
- Removedp-queue@7.4.1(transitive)
- Removedp-timeout@5.1.0(transitive)
Updatedmeow@^13.2.0
Updatedp-queue@^8.0.1