1.0.4 • Published 8 years ago

google-image v1.0.4

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

Modules

Classes

Typedefs

node-google-image

Find image data using the deprecated Google Image Search API. Google has disabled the API. As such, this module is no longer functional.

Author: Matthew Hasbach
License: MIT
Copyright: Matthew Hasbach 2015
Example

new googleImage('car')
    .quantity(5)
    .page(2)
    .search()
    .then(function(images) {
        images[0].save(path.join(__dirname, images[0].fileName)).then(function() {
            console.log('done');
        }).catch(function(err) {
            console.error(err);
        });
    }).catch(function(err) {
        console.error(err);
    });

node-google-image~googleImage

Kind: inner class of node-google-image

node-google-image

Kind: global class

ParamTypeDescription
qstringA search query. This may be omitted and supplied later using the options or search method.

node-google-image.quantity(quantity) ↩︎

Set the desired size of the result set

Kind: instance method of node-google-image
Chainable

ParamTypeDescription
quantitynumberThe result set size

node-google-image.page(page) ↩︎

Set the desired page number

Kind: instance method of node-google-image
Chainable

ParamTypeDescription
pagenumberThe page number

node-google-image.options(opt) ↩︎

Set Google Image Search API options

Kind: instance method of node-google-image
Chainable

ParamTypeDescription
optObjectAPI options

node-google-image.search(opt, cb) ⇒ Promise

Search for images. The default page and quantity are 0 and 1, respectively.

Kind: instance method of node-google-image

ParamTypeDescription
optObjectAPI options
cbcallbackA callback to be executed once the search is complete

responseDataResults : Array.<imageData>

Response data results

Kind: global typedef

imageData : Object.<string, function()>

Image data extended with the image's filename and convenience methods

Kind: global typedef

imageData.fileName : string

Image filename

Kind: instance property of imageData

imageData.download(cb) ⇒ Promise

Download an image

Kind: instance method of imageData

ParamTypeDescription
cbcallbackA callback to be executed once the download is complete

download~callback : function

Kind: inner typedef of download

ParamTypeDescription
errError | nullAn error if one was encountered
imageDataBuffer | undefinedImage data

imageData.save(path, cb) ⇒ Promise

Save an image

Kind: instance method of imageData

ParamTypeDescription
pathstringA callback to be executed once the image has been saved
cbcallbackA callback to be executed once the image has been saved

save~callback : function

Kind: inner typedef of save

ParamTypeDescription
errError | nullAn error if one was encountered