From 3e98716b8d3939c6171efa534483041900200d9c Mon Sep 17 00:00:00 2001 From: Jayden Seric Date: Mon, 25 May 2020 15:17:42 +1000 Subject: [PATCH] Mention Promise.allSettled in tips, update MDN links. --- changelog.md | 4 +++- readme.md | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 4bcb470..5a3715d 100644 --- a/changelog.md +++ b/changelog.md @@ -17,6 +17,8 @@ - Also run GitHub Actions with Node.js v14. - Fixed the `ignoreStream` function tests for Node.js v14 with a new `CountReadableStream` test helper, fixing [#209](https://github.com/jaydenseric/graphql-upload/issues/209). - Minor JSDoc wording tweak for consistency. +- Mention [`Promise.allSettled`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/allSettled) in the readme “Tips” section. +- Updated MDN Web Docs links. ## 10.0.0 @@ -324,7 +326,7 @@ Big thanks to new collaborator [@mike-marcacci](https://github.com/mike-marcacci - Updated dependencies. - Simplified npm scripts. - Readme updates: - - Documented [`Blob`](https://developer.mozilla.org/en/docs/Web/API/Blob) types, via [#39](https://github.com/jaydenseric/apollo-upload-server/pull/39). + - Documented [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) types, via [#39](https://github.com/jaydenseric/apollo-upload-server/pull/39). - Explained how to use `processRequest` for custom middleware. - Improved usage instructions. - Display oldest supported Node.js version. diff --git a/readme.md b/readme.md index 8105a32..e1ebaf3 100644 --- a/readme.md +++ b/readme.md @@ -49,7 +49,7 @@ See the [example API and client](https://github.com/jaydenseric/apollo-upload-ex - The device requires sufficient disk space to buffer the expected number of concurrent upload requests. - Promisify and await file upload streams in resolvers or the server will send a response to the client before uploads are complete, causing a disconnect. - Handle file upload promise rejection and stream errors; uploads sometimes fail due to network connectivity issues or impatient users disconnecting. -- Process multiple uploads asynchronously with [`Promise.all`](https://developer.mozilla.org/docs/web/javascript/reference/global_objects/promise/all) or a more flexible solution where an error in one does not reject them all. +- Process multiple uploads asynchronously with [`Promise.all`](https://developer.mozilla.org/en-US/docs/web/javascript/reference/global_objects/promise/all) or a more flexible solution such as [`Promise.allSettled`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/allSettled) where an error in one does not reject them all. - Only use [`createReadStream()`](#type-fileupload) _before_ the resolver returns; late calls (e.g. in an unawaited async function or callback) throw an error. Existing streams can still be used after a response is sent, although there are few valid reasons for not awaiting their completion. - Use [`stream.destroy()`](https://nodejs.org/api/stream.html#stream_readable_destroy_error) when an incomplete stream is no longer needed, or temporary files may not get cleaned up.