1.0.1 • Published 8 months ago

async-image-search v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

async-image-search

Asynchronous Google Images search.

Returns:

{ width: number, height: number, url: string }[]

Installation

npm install async-image-search

Usage/Examples

import { search as imageSearch } from "async-image-search";

async function getImage(query, index = 0) {
	const results = await imageSearch(query);

	console.log(`Found ${results.length} results for ${query}.`);

	return results[Math.min(index, results.length - 1)];
}

getImage("Rosalina").then((image) => {
	const { width, height, url } = image;
	console.log(`Image (${width} x ${height}): ${url}`);
});

Contributing

Please open an issue for bug reports, or a pull request if you want to contribute.

1.0.1

8 months ago

1.0.0

8 months ago