MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / detectFulltextGCS

Function detectFulltextGCS

vision/detect.js:664–686  ·  view source on GitHub ↗
(bucketName, fileName)

Source from the content-addressed store, hash-verified

662}
663
664async function detectFulltextGCS(bucketName, fileName) {
665 // [START vision_fulltext_detection_gcs]
666
667 // Imports the Google Cloud client libraries
668 const vision = require('@google-cloud/vision');
669
670 // Creates a client
671 const client = new vision.ImageAnnotatorClient();
672
673 /**
674 * TODO(developer): Uncomment the following lines before running the sample.
675 */
676 // const bucketName = 'Bucket where the file resides, e.g. my-bucket';
677 // const fileName = 'Path to file within bucket, e.g. path/to/image.png';
678
679 // Read a remote image as a text document
680 const [result] = await client.documentTextDetection(
681 `gs://${bucketName}/${fileName}`
682 );
683 const fullTextAnnotation = result.fullTextAnnotation;
684 console.log(fullTextAnnotation.text);
685 // [END vision_fulltext_detection_gcs]
686}
687
688async function detectPdfText(bucketName, fileName, outputPrefix) {
689 // [START vision_text_detection_pdf_gcs]

Callers 1

detect.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected