2 ms·
I would have written it in a more functional way: async function totalSize(fol) { const files = await fol.getFiles(); const sizes = await Promise.all
by tlrobinson 7y ago
I would have written it in a more functional way:
async function totalSize(fol) {
const files = await fol.getFiles();
const sizes = await Promise.all(files.map(file => file.getSize()));
return sizes.reduce((acc, size) => acc + size);
}