Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Downloade image(s), by command or programmatically
img-dl can be installed in the global scope (if you'd like to have it available and use it on the whole system) or locally for a specific package (especially if you'd like to use it programmatically):
Install globally:
npm install -g img-dl
Install locally:
npm install img-dl
Access the help page with imgdl --help
Download an image from a URL
USAGE
$ imgdl <url> ... [OPTIONS]
PARAMETERS
url The URL of the image to download. Provide multiple URLs to download multiple images.
In increment mode, the URL must contain {i} placeholder for the index,
only one URL is allowed, and the 'end' flag is required.
OPTIONS
-d, --dir=<path> The output directory. Default: current working directory
--end=<number> The end index. Required in increment mode
-e, --ext=<ext> The file extension. Default: original extension or jpg
-h, --help Show this help message
-i, --increment Enable increment mode. Default: false
-n, --name=<filename> The filename. Default: original filename or timestamp
--silent Disable logging
--start=<number> The start index for increment mode. Default: 0
-v, --version Show the version number
EXAMPLES
$ imgdl https://example.com/image.jpg
$ imgdl https://example.com/image.jpg --dir=images --name=example --ext=png
$ imgdl https://example.com/image.jpg --silent
$ imgdl https://example.com/image.jpg https://example.com/image2.webp
$ imgdl https://example.com/image-{i}.jpg --increment --start=1 --end=10
imgdl https://example.com/image.jpg
imgdl https://example.com/image.jpg https://example.com/image2.jpg
imgdl https://example.com/image-{i}.jpg --increment --start=1 --end=10
import imgdl from 'img-dl';
const image = await imgdl('https://example.com/image.jpg');
console.log(image);
/*
{
url: 'https://example.com/image.jpg',
name: 'image',
extension: 'jpg',
directory: '/path/to/current/working/directory',
originalName: 'image',
originalExtension: 'jpg',
path: '/path/to/current/working/directory/image.jpg',
}
*/
import imgdl from 'img-dl';
const images = await imgdl([
'https://example.com/image.jpg',
'https://example.com/image2.jpg',
]);
Download image(s) from the given URL(s).
url
Type: string | string[]
Required: true
The URL(s) of the image(s) to download. Required.
options
Type: Options
Required: false
Properties | Type | Default | Description |
---|---|---|---|
options.directory | string | process.cwd() | The output directory |
options.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. |
options.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. When downloading multiple images, -index will be appended to the end of the name (suffix). index will start from 1. For example: image-1 |
options.onSuccess | (image: Image) => void | undefined | The callback function to be called when the image is successfully downloaded. Only available when downloading multiple images. |
options.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. |
FAQs
Download image(s), by command or programmatically
The npm package img-dl receives a total of 54 weekly downloads. As such, img-dl popularity was classified as not popular.
We found that img-dl demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.