Async who?
This commit is contained in:
parent
09a5c6bf1e
commit
76d48602c6
|
@ -152,13 +152,12 @@ albumsController.generateZip = async (req, res, next) => {
|
||||||
let archive = new Zip();
|
let archive = new Zip();
|
||||||
|
|
||||||
for (let file of files) {
|
for (let file of files) {
|
||||||
fs.stat(path.join(__dirname, '..', config.uploads.folder, file.name), (err, stats) => {
|
try {
|
||||||
if (err) {
|
const exists = fs.statSync(path.join(__dirname, '..', config.uploads.folder, file.name));
|
||||||
console.log(err);
|
|
||||||
} else {
|
|
||||||
archive.file(file.name, fs.readFileSync(path.join(__dirname, '..', config.uploads.folder, file.name)));
|
archive.file(file.name, fs.readFileSync(path.join(__dirname, '..', config.uploads.folder, file.name)));
|
||||||
|
} catch (err) {
|
||||||
|
console.log(err);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
archive
|
archive
|
||||||
|
|
Loading…
Reference in New Issue