Skip to content

Fetch asynchronously an image using it's source and resolve as `HTMLImageElement`.

Notifications You must be signed in to change notification settings

VitorLuizC/fetch-img

Repository files navigation

Fetch IMG

Build Status

Fetch asynchronously an image using it's source and resolve as HTMLImageElement.

Install

This module is published under NPM registry, so you can install using any Node.js package manager.

npm install fetch-img --save

# Use the command below for Yarn.
yarn add fetch-img

Usage

import fetchIMG from 'fetch-img';

fetchIMG('https://nodejs.org/static/images/logo.svg')
  .then((img) => document.body.appendChild(img))
  .catch((error) => console.error(error));

License

Released under MIT license.

Releases

No releases published

Packages

No packages published