utils.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:NordVPN-NetworkManager 作者: Chadsr 项目源码 文件源码
def extract_zip(input_stream, output_path, chown_to_user=True):
    try:
        zipfile = ZipFile(BytesIO(input_stream))
        zipfile.extractall(output_path)
        file_list = zipfile.namelist()

        if chown_to_user:
            # chown the extracted files to the current user, instead of root
            for file_name in file_list:
                file_path = os.path.join(output_path, file_name)
                chown_path_to_user(file_path)
        return True

    except Exception as ex:
        logger.error(ex)
        return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号