import base64


def create_uri_from_file(path):
    """
    Creates a base64 uri for loading a html file from the vfs
    """
    html = open(path).read()
    html = html.encode('utf-8', 'replace')
    b64 = base64.b64encode(html).decode('utf-8', 'replace')
    uri = 'data:text/html;base64,%s' % b64
    return uri