Skip to content

ALLCAPSDEV/gcp-cv-import

Repository files navigation

gcp-cv-import

Description

Package to bulk import your GCP Cloud vision product set.

Dependabot Status npm Language grade: JavaScript Maintainability FOSSA Status

Usage

Install locally using npm

npm i -s @allcapsdev/gcp-cv-import

Then within your code:

import ImportProductSet from '@allcapsdev/gcp-cv-import';

const importPrdSet = new ImportProductSet({
  projectId: 'some-gcp-project',
  location: 'europe-west1',
  csvUri: 'gs://some-bucket/a-csv-file.csv'
});

const importResults = importPrdSet.import();

There is an optional argument that can be passed into new ImportProductSet which is, logger.

By default logger will use the standard console to log the results, however if you use something like winston or a custom logger, you can pass that in. The only stipulation is that it has to have a .info method.

ToDo

  • Handle errors better, the current approach just uses the errors provided from @google-cloud/vision - which aren't always that descriptive.

  • More tests & better mocking.

  • Improve the docs