hashFile: process filename in chunks

This reduces the memory requirements to a single buffer size.

I read a bit of the file at the start so that we can still store small files in the database.