DC21-75: optimise metadata extraction so that it doesn't scan the entire file