npm.io
1.4.0 • Published 3 years ago

html-load-image

Licence
MIT
Version
1.4.0
Deps
1
Size
11 kB
Vulns
0
Weekly
0

HTML Load Image Package

Overview

This package is to get the image files as dataURLs from Event or DragEvent. It's using blueimp-load-image package as a dependency.

Install

yarn add html-load-image

Definitions

type getImage = (event: Event, options?: LoadImageOptions) => Promise<string>

type getImages = (event: Event, options?: LoadImagesOptions) => Promise<string[]>

type LoadImageOptions = Omit<BlueImpLoadImageOptions, 'orientation' | 'meta' | 'canvas'>

interface LoadImagesOptions extends LoadImageOptions {
  maxLoadImageCount: number
}

Usage

const image = await getImage(event)
const images = await getImages(event, { maxLoadImageCount: 5 })