Load the export directory size

Node · Node · intermediate · greenfield

Adds a small helper around fs.stat to read a file's size before we stream it. Awaits the stat call and returns the size in bytes.

Runs inside the export service on Node 20; the project has no custom fs wrappers.

Requirements

Files touched

--- src/exports/fileSize.js
+const fs = require('fs');
+
+async function fileSize(path) {
+  const stats = await fs.stat(path);
+  return stats.size;
+}
+
+module.exports = { fileSize };

Review this PR

Node practice