1.3.0 • Published 3 years ago

image-helpers v1.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

image-helpers

License

Helper methods to receive and create HTMLImageElements

Methods

fetchImages

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<Array<ImageType>> => {}

verifyUrls

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

Install

npm install image-helpers

Development

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