async-image-search
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

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.

Package Sidebar

Install

npm i async-image-search

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

5.78 kB

Total Files

5

Last publish

Collaborators

  • ciiro