Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

retrieve-all-images

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

retrieve-all-images

A function that retrieves all images for a given a webpage and outputs them, named as they are on the webpage, to the provided folder path. Note that the url should NOT include a trailing slash, as this can cause problems with how `srcset` paths are deter

latest
Source
npmnpm
Version
1.1.7
Version published
Maintainers
1
Created
Source

retrieve-all-images

A function that retrieves all images for a given a webpage and outputs them, named as they are on the webpage, to the provided folder path. Note that the url should NOT include a trailing slash, as this can cause problems with how srcset paths are determined, if they are provided as a relative path on the desired retrieval page.

TypeScript Usage:

import { retrieveAllImages } from 'retrieve-all-images';
import path from 'path';

// retrieves all images present on CNN homepage to folder in project root folder under output-images/
// also prints out the objects returned which includes the src used to download, the base filename, and the alt
async function test() {
  const retrievedImageInfos = await retrieveAllImages(
    "https://edition.cnn.com",
    path.join(__dirname, "..", "output-images")
  );
  console.log(
    "Done with image retrieval. Retrieved image data: " +
      JSON.stringify(retrievedImageInfos)
  );
}

test();

FAQs

Package last updated on 25 Jun 2020

Did you know?

Socket

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.

Install

Related posts