Open xeroxstar opened 5 years ago
Hello, The client details that returns to the browser after the upload is completed should have return promise also. for example:
let uploader = new siofu(); uploader.on('saved', async (event) => { event.file.clientDetail = new Promise((x) => { x({data: 'hello world'}); }) }); uploader.dir = "./uploads"; uploader.listen(socket);
to solve it i edit few lines in server.js to make it work:
socket.emit(_getTopicName("_complete"), _wrapData({ id: id, success: success, detail: typeof fileInfo.clientDetail.then === 'function' ? await fileInfo.clientDetail:fileInfo.clientDetail }, "complete"));
i think it will be a nice option if we will have this in the module so devs will have more flexible way to work with the data. Anyway, it works great.
Looks good. My only feedback is if you can make this work without the "await" keyword, then the same source can be used on older versions of Node.js. Can you open a PR?
Hello, The client details that returns to the browser after the upload is completed should have return promise also. for example:
to solve it i edit few lines in server.js to make it work:
i think it will be a nice option if we will have this in the module so devs will have more flexible way to work with the data. Anyway, it works great.