From 97f69844579fd789e7eb8009eab28a69640a5859 Mon Sep 17 00:00:00 2001 From: Dave Gramlich Date: Mon, 29 Aug 2016 18:03:27 -0400 Subject: [PATCH] docs: updated vision detect params/examples (#1500) * docs: updated vision detect params/examples * updated buffer example --- src/index.js | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index 50f3dc0d..a4856e94 100644 --- a/src/index.js +++ b/src/index.js @@ -133,6 +133,7 @@ Vision.prototype.annotate = function(requests, callback) { }); }; +// jscs:disable maximumLineLength /** * Detect properties from an image (or images) of one or more types. * @@ -156,9 +157,10 @@ Vision.prototype.annotate = function(requests, callback) { * For the response in the original format, review the `apiResponse` argument * your callback receives. * - * @param {string|string[]|module:storage/file|module:storage/file[]} images - - * The source image(s) to run the detection on. It can be either a local - * image path, a remote image URL, or a @google-cloud/storage File object. + * @param {string|string[]|buffer|buffer[]|module:storage/file|module:storage/file[]} images - The + * source image(s) to run the detection on. It can be either a local image + * path, a remote image URL, a Buffer, or a @google-cloud/storage File + * object. * @param {string[]|object=} options - An array of types or a configuration * object. * @param {object=} options.imageContext - See an @@ -210,6 +212,20 @@ Vision.prototype.annotate = function(requests, callback) { * vision.detect(img, types, function(err, detection, apiResponse) {}); * * //- + * // Run feature detection over a Buffer. + * //- + * var level = require('level'); + * var db = level('./users-database'); + * + * db.get('user-image', { encoding: 'binary' }, function(err, image) { + * if (err) { + * // Error handling omitted. + * } + * + * vision.detect(image, function(err, detection, apiResponse) {}); + * }); + * + * //- * // Supply multiple images for feature detection. * //- * var images = [ @@ -519,6 +535,7 @@ Vision.prototype.detect = function(images, options, callback) { }); }); }; +// jscs:enable maximumLineLength /** * Run face detection against an image.