-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add DLP redact image sample #438
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple nits, not a big deal.
dlp/redact.js
Outdated
fs.writeFileSync(outputPath, image); | ||
}) | ||
.then(() => { | ||
console.log(`Saved image redaction results to path: ${outputPath}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This console.log
doesn't need to be in its own promise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True - unless we decide to promisify writeFileSync()
in some way. (See my comment above.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, keep the sync function and move this up.
dlp.redactContent(request) | ||
.then((response) => { | ||
const image = response[0].items[0].data; | ||
fs.writeFileSync(outputPath, image); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Best practice would not be to use a blocking call to write the file, though it makes the sample simpler. I'll leave it up to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed all around - I was going with the simpler-sample approach here.
We could use this module, if we don't mind adding additional dependencies.
Otherwise, I'd personally vote for using the sync
functions.
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that they're okay with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
Codecov Report
@@ Coverage Diff @@
## master #438 +/- ##
=======================================
Coverage 83.84% 83.84%
=======================================
Files 4 4
Lines 421 421
=======================================
Hits 353 353
Misses 68 68 Continue to review full report at Codecov.
|
Closing, as #441 was merged. |
Co-authored-by: Benjamin E. Coe <[email protected]>
Co-authored-by: Benjamin E. Coe <[email protected]>
Co-authored-by: Benjamin E. Coe <[email protected]>
Co-authored-by: Benjamin E. Coe <[email protected]>
Co-authored-by: Benjamin E. Coe <[email protected]>
Co-authored-by: Benjamin E. Coe <[email protected]>
Co-authored-by: Benjamin E. Coe <[email protected]>
🤖 I have created a release \*beep\* \*boop\* --- ## [5.7.0](https://github.com/googleapis/nodejs-security-center/compare/v5.6.0...v5.7.0) (2021-11-15) ### Features * Added mute related APIs, proto messages and fields ([#438](https://github.com/googleapis/nodejs-security-center/issues/438)) ([d432649](https://github.com/googleapis/nodejs-security-center/commit/d432649fed31f92a6048769b6b889666f5b9cced)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Co-authored-by: Benjamin E. Coe <[email protected]>
No description provided.