file.contents should be a buffer