Low cost way to check whether Archetypes File has payload (BLOB)

129 Views Asked by At

Is there a way to quick check whether Archetypes File field contains payload or not, without actually loading the content of the file to memory?

I am remotely syncing files into Archetypes content items and I'd like to avoid the sync iteration if the file already exists. I am potentially iterating through hundreds of files, so I'd like to avoid the situation Plone reads every file to memory just whether is has zero bytes or some other data.

Plone 4.1.

1

There are 1 best solutions below

4
On

On ATFiles there's a size() method to check the file size. It seems that the size isn't stored anywhere, so maybe a adding a column on the catalog will work for you.