Checking the emptyness of an output page

Hi,
I have

{{ with (.Page.Store.Get "all_sources") }}
{{ range .}}
{{ . | htmlUnescape}}
{{ end }}
{{ end }}

in single.csv, but can I produce that file conditionally, only if it’s not empty, without overriding the outputs parameter in the frontmatters ?

Also, why is this {{ (.OutputFormats.Get "csv").RelPermalink }} correct but not this: {{ (.OutputFormats.Get "csv").RawContent }} ? I wanted to use {{ if gt (len (.OutputFormats.Get “csv”).RawContent) 0 }}, although I’m not sure if an empty file will have a length of 0 or 1 according to hugo.

thanks