google-image v1.0.4
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
Param | Type | Description |
---|---|---|
q | string | A 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
Param | Type | Description |
---|---|---|
quantity | number | The result set size |
node-google-image.page(page) ↩︎
Set the desired page number
Kind: instance method of node-google-image
Chainable
Param | Type | Description |
---|---|---|
page | number | The page number |
node-google-image.options(opt) ↩︎
Set Google Image Search API options
Kind: instance method of node-google-image
Chainable
Param | Type | Description |
---|---|---|
opt | Object | API 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
Param | Type | Description |
---|---|---|
opt | Object | API options |
cb | callback | A 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 : Object.<string, function()>
- .fileName : string
- .download([cb]) ⇒ Promise
- ~callback : function
- .save(path, [cb]) ⇒ Promise
- ~callback : function
imageData.fileName : string
Image filename
Kind: instance property of imageData
imageData.download(cb) ⇒ Promise
Download an image
Kind: instance method of imageData
Param | Type | Description |
---|---|---|
cb | callback | A callback to be executed once the download is complete |
download~callback : function
Kind: inner typedef of download
Param | Type | Description |
---|---|---|
err | Error | null | An error if one was encountered |
imageData | Buffer | undefined | Image data |
imageData.save(path, cb) ⇒ Promise
Save an image
Kind: instance method of imageData
Param | Type | Description |
---|---|---|
path | string | A callback to be executed once the image has been saved |
cb | callback | A callback to be executed once the image has been saved |
save~callback : function
Kind: inner typedef of save
Param | Type | Description |
---|---|---|
err | Error | null | An error if one was encountered |