Extracted from https://github.com/ziglang/zig/pull/25592. On several operating systems there is a more efficient way to get only the size of a file when the full stat is not needed.