Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including node-google-image-search with all npm packages installed. Try it out:

var nodeGoogleImageSearch = require("node-google-image-search")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

node-google-image-search v1.0.3

A Node module to search for images using Google

Google Image Search

a simple way to get image results from a google custom search engine using node



This module uses the dotenv package to manage environment variables In your main app you will also need to use dotenv Create two new Keys in your .env file and set the values to your CSE ID and your Google CSE API Keys

  • CSE_ID=

Calling from your app

In your app require the module Within your code call the module with the following parameters

  1. Search Term
  2. Callback function (will be called once results are ready)
  3. ID number of result you want to offset from
  4. Number of results you want (between 1-10 inclusive)


index.js of main app

var imageSearch = require('node-google-image-search');

var results = imageSearch('<search-term>', callback, 0, 5);

function callback(results) {
    _do something with results_;


Maximum number of results from Google CSE is 100, this app will return up to 10 at a time. So, if offset + number of results wanted > 100 then nothing will be returned

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free