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

Function readImage

dlp/system-test/redact.test.js:32–41  ·  view source on GitHub ↗
(filePath)

Source from the content-addressed store, hash-verified

30const client = new DLP.DlpServiceClient();
31
32async function readImage(filePath) {
33 return new Promise((resolve, reject) => {
34 fs.createReadStream(filePath)
35 .pipe(new PNG())
36 .on('error', reject)
37 .on('parsed', function () {
38 resolve(this);
39 });
40 });
41}
42
43async function getImageDiffPercentage(image1Path, image2Path) {
44 const image1 = await readImage(image1Path);

Callers 1

getImageDiffPercentageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected