a lib to encode file