-
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
Clarify comments + add field handler to multipart sample #609
Conversation
Codecov Report
@@ Coverage Diff @@
## master #609 +/- ##
=======================================
Coverage 48.52% 48.52%
=======================================
Files 1 1
Lines 68 68
=======================================
Hits 33 33
Misses 35 35 Continue to review full report at Codecov.
|
multipart
sample
functions/http/index.js
Outdated
// This object will accumulate all the uploaded files, keyed by their name. | ||
const uploads = {}; | ||
const tmpdir = os.tmpdir(); | ||
|
||
// This callback will be invoked for each file uploaded. | ||
// This event will be triggered for each non-file field in the form. |
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.
I'm a bit afraid that users may confuse events described above, with event that trigger a function. For instance, users may think that there are many function executions here.
I think the previous form ("This callback will be invoked") was a bit better
Also, busboy docs say that events are emitted, not triggered.
How about something like this:
- "This code is executed on..."
- "This code handles busboy events emitted on..."
- "This busboy events are emitted on..."
functions/http/index.js
Outdated
@@ -148,20 +148,31 @@ exports.uploadFile = (req, res) => { | |||
if (req.method === 'POST') { | |||
const busboy = new Busboy({ headers: req.headers }); | |||
|
|||
// This object will accumulate all the fields, keyed by their name | |||
const fields = {}; | |||
|
|||
// This object will accumulate all the uploaded files, keyed by their name. | |||
const uploads = {}; | |||
const tmpdir = os.tmpdir(); |
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.
I would add an empty line before:
const tmpdir = os.tmpdir();
Otherwise it looks like the comment "This object will accumulate all the uploaded files, keyed by their name" is for the two lines.
You can group this "const tmpdir" together with "const busboy"
🤖 I have created a release \*beep\* \*boop\* --- ### [4.2.9](https://www.github.com/googleapis/nodejs-language/compare/v4.2.8...v4.2.9) (2021-08-17) ### Bug Fixes * **deps:** google-gax v2.24.1 ([#608](https://www.github.com/googleapis/nodejs-language/issues/608)) ([81d9fa1](https://www.github.com/googleapis/nodejs-language/commit/81d9fa1ff73ea6129d85bcf071cadd3946b9bdd7)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
🤖 I have created a release \*beep\* \*boop\* --- ### [4.2.9](https://www.github.com/googleapis/nodejs-language/compare/v4.2.8...v4.2.9) (2021-08-17) ### Bug Fixes * **deps:** google-gax v2.24.1 ([#608](https://www.github.com/googleapis/nodejs-language/issues/608)) ([81d9fa1](https://www.github.com/googleapis/nodejs-language/commit/81d9fa1ff73ea6129d85bcf071cadd3946b9bdd7)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
🤖 I have created a release \*beep\* \*boop\* --- ## [3.0.0](https://www.github.com/googleapis/nodejs-compute/compare/v2.6.0...v3.0.0) (2021-08-17) ### ⚠ BREAKING CHANGES * new generated version of compute API (#537) ### Features * new generated version of compute API ([#537](https://www.github.com/googleapis/nodejs-compute/issues/537)) ([4023676](https://www.github.com/googleapis/nodejs-compute/commit/4023676e121e3b3c71b681dbd77136ab74184e68)) ### Bug Fixes * **build:** migrate to using main branch ([#609](https://www.github.com/googleapis/nodejs-compute/issues/609)) ([3013bb5](https://www.github.com/googleapis/nodejs-compute/commit/3013bb53258d738e136327fd027b6ea4fae835db)) * **deps:** google-gax v2.24.1 ([#612](https://www.github.com/googleapis/nodejs-compute/issues/612)) ([8569747](https://www.github.com/googleapis/nodejs-compute/commit/856974738ab7051cdbf05575bc5871c0b6b4ea28)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
🤖 I have created a release \*beep\* \*boop\* --- ## [3.0.0](https://www.github.com/googleapis/nodejs-compute/compare/v2.6.0...v3.0.0) (2021-08-17) ### ⚠ BREAKING CHANGES * new generated version of compute API (#537) ### Features * new generated version of compute API ([#537](https://www.github.com/googleapis/nodejs-compute/issues/537)) ([4023676](https://www.github.com/googleapis/nodejs-compute/commit/4023676e121e3b3c71b681dbd77136ab74184e68)) ### Bug Fixes * **build:** migrate to using main branch ([#609](https://www.github.com/googleapis/nodejs-compute/issues/609)) ([3013bb5](https://www.github.com/googleapis/nodejs-compute/commit/3013bb53258d738e136327fd027b6ea4fae835db)) * **deps:** google-gax v2.24.1 ([#612](https://www.github.com/googleapis/nodejs-compute/issues/612)) ([8569747](https://www.github.com/googleapis/nodejs-compute/commit/856974738ab7051cdbf05575bc5871c0b6b4ea28)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
🤖 I have created a release \*beep\* \*boop\* --- ## [3.0.0](https://www.github.com/googleapis/nodejs-compute/compare/v2.6.0...v3.0.0) (2021-08-17) ### ⚠ BREAKING CHANGES * new generated version of compute API (#537) ### Features * new generated version of compute API ([#537](https://www.github.com/googleapis/nodejs-compute/issues/537)) ([4023676](https://www.github.com/googleapis/nodejs-compute/commit/4023676e121e3b3c71b681dbd77136ab74184e68)) ### Bug Fixes * **build:** migrate to using main branch ([#609](https://www.github.com/googleapis/nodejs-compute/issues/609)) ([3013bb5](https://www.github.com/googleapis/nodejs-compute/commit/3013bb53258d738e136327fd027b6ea4fae835db)) * **deps:** google-gax v2.24.1 ([#612](https://www.github.com/googleapis/nodejs-compute/issues/612)) ([8569747](https://www.github.com/googleapis/nodejs-compute/commit/856974738ab7051cdbf05575bc5871c0b6b4ea28)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Do not merge until the docs have been updated accordingly.cc @marekbiskup