mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2025-01-31 07:11:33 +00:00
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);
|
archive.file(file.name, fs.readFileSync(path.join(__dirname, '..', config.uploads.folder, file.name)));
|
||||||
} else {
|
} catch (err) {
|
||||||
archive.file(file.name, fs.readFileSync(path.join(__dirname, '..', config.uploads.folder, file.name)));
|
console.log(err);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
archive
|
archive
|
||||||
|
Loading…
Reference in New Issue
Block a user