Make the Upstream object thennable, in order to be able to cleanly use ES6's Promises and await / async.
So that instead of:
async function myFunction(req, res) {
const config = {adapter: ..., ...};
const uploadPromise = new Promise((resolve, reject) => {
req.file('file').upload(config, (err, result) => {
if (err) {
return reject(err);
}
resolve(result);
}
}
await uploadPromise();
// ...
}
We can simply do:
async function myFunction(req, res) {
const config = {adapter: ..., ...};
await req.file('file').upload(config);
}
In order to do that, a .then(resolve, reject) methods needs to be added to the Upstream object. It would call resolve once all uploads are done, and reject(err) in case of an error.
@coyotte508 Thanks for posting, we'll take a look as soon as possible. In the meantime, if you haven鈥檛 already, please carefully read the issue contribution guidelines and double-check for any missing information above. In particular, please ensure that this issue is about a stability or performance bug with a documented feature; and make sure you鈥檝e included detailed instructions on how to reproduce the bug from a clean install. Finally, don鈥檛 forget to include the version of Node.js you tested with, as well as your version of Sails or Waterline, and of any relevant standalone adapters/generators/hooks.
Thank you!
For help with questions about Sails, click here. If you’re interested in hiring @sailsbot and her Austin-based minions, click here.
@coyotte508,@sailsbot: Hello, I'm a repo bot-- nice to meet you!
It has been 30 days since there have been any updates or new comments on this page. If this issue has been resolved, feel free to disregard the rest of this message and simply close the issue if possible. On the other hand, if you are still waiting on a patch, please post a comment to keep the thread alive (with any new information you can provide).
If no further activity occurs on this thread within the next 3 days, the issue will automatically be closed.
Thanks so much for your help!
Hello, I'm ok to close this if this is not relevant, I'd just like an answer from someone.
@coyotte508,@sailsbot: Hello, I'm a repo bot-- nice to meet you!
It has been 30 days since there have been any updates or new comments on this page. If this issue has been resolved, feel free to disregard the rest of this message and simply close the issue if possible. On the other hand, if you are still waiting on a patch, please post a comment to keep the thread alive (with any new information you can provide).
If no further activity occurs on this thread within the next 3 days, the issue will automatically be closed.
Thanks so much for your help!
bump. this is still an issue
Most helpful comment
bump. this is still an issue