An open API service indexing awesome lists of open source software.

https://github.com/erhangundogan/image-helpers

Tiny typescript library to fetch multiple images
https://github.com/erhangundogan/image-helpers

image-fetch image-loader image-loading image-loading-library

Last synced: about 1 month ago
JSON representation

Tiny typescript library to fetch multiple images

Awesome Lists containing this project

README

          

image-helpers
=============

[![License][license-src]][license-href]

Helper methods to receive and create HTMLImageElements

# Methods

## fetchImages

```typescript
export interface FetchImagesOptionsPropsType {
tryCors?: boolean;
failEarly?: boolean;
}
export interface FetchImagesCorsOptionsPropsType {
generateHash?: boolean;
fetchOptions?: RequestInit;
}
const fetchImages = async (
imageUrls: string[] = [],
options: FetchImagesOptionsPropsType = { tryCors: false, failEarly: false },
corsOptions: FetchImagesCorsOptionsPropsType = { generateHash: false, fetchOptions: { cache: 'force-cache' } }
): Promise> => {}
```

## verifyUrls

```typescript
export interface VerifyUrlsPropsType {
maxFileSize?: number;
ignoreRequestErrors?: boolean;
testUrls?: boolean;
requiredOrigin?: string | undefined;
}
const verifyUrls = async (urls: Array, options: VerifyUrlsPropsType = {}): Promise> => {}
```

# Install
```bash
npm install image-helpers
```

# Development
```bash
git clone git@github.com:erhangundogan/image-helpers.git
cd image-helpers
npm i
npm run build
npm run test
```

[license-src]: https://img.shields.io/badge/license-MIT-brightgreen.svg
[license-href]: LICENSE.md