diff --git a/lib/files.js b/lib/files.js index 5550483..0542a6c 100644 --- a/lib/files.js +++ b/lib/files.js @@ -15,7 +15,7 @@ const reIgnore = /^[._]/ module.exports = (base, default_price, invoice_ttl, files_attr) => { - const load = async (_path, basic=false) => { + const load = async (_path, shallow=false) => { const fullpath = upath.resolve(base, _path) , relpath = upath.relative(base, fullpath) , dirname = upath.dirname(relpath) @@ -28,9 +28,9 @@ module.exports = (base, default_price, invoice_ttl, files_attr) => { const file = { fullpath, path: relpath, urlpath: escape(relpath), name, ext, dirname, attr } , stat = await fs.stat(fullpath) - return stat.isDirectory() ? { ...file, type: 'dir', files: !basic && await listFiles(fullpath) } + return stat.isDirectory() ? { ...file, type: 'dir', files: !shallow && await listFiles(fullpath) } : stat.isFile() ? { ...file, type: 'file', size: stat.size, price: attr.price || default_price - , mime: await getMime(file), exif: !basic && await getExif(fullpath) } + , mime: await getMime(file), exif: !shallow && await getExif(fullpath) } : null }