<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def minify_file(self, target):
 """ Minifies the target html file. """

        html = open(target, 'rb').read()
        enc = chardet.detect(html)['encoding']
        with codecs.open(target, 'r+', enc) as f:
            result = htmlmin.minify(f.read(), **self.options)
            f.seek(0)
            f.write(result)
            f.truncate()