Re-implement for all non-regular files.

Fixes #1.

Needs better tests, probably.