We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
'use strict'; const fs = require('fs'); const unZip = require('unzip2'); const fswrap = filepath => new Promise((resolve, reject) => { const readable = fs.createReadStream(filepath).pipe(unZip.Extract({ path: './' })); readable.on('close', () => resolve(buf)); readable.on('error', err => reject(err)); }); const main = async () => { await fswrap('./notexistfile'); }; main().catch(e => console.error(e));
In this case, ./notexistfile is not exist, and I can't catch error. What should I do if I want to catch error.
./notexistfile
The text was updated successfully, but these errors were encountered:
I solve it with split code, such as
const fswrap = filepath => new Promise((resolve, reject) => { const readable = fs.createReadStream(filepath); const pipistream = readable.pip(unZip.Extract({ path: './' })); pipistream.on('close', () => resolve()); readable.on('error', e => reject(e)); });
I do not know if it will parameter more problem, but I test can catch error or get right value.
Sorry, something went wrong.
No branches or pull requests
In this case,
./notexistfile
is not exist, and I can't catch error. What should I do if I want to catch error.The text was updated successfully, but these errors were encountered: