mirror of
https://github.com/amix/vimrc
synced 2025-02-28 14:12:51 +08:00
bytesio
This commit is contained in:
parent
14906f26a0
commit
324947e2f3
@ -11,6 +11,7 @@ import shutil
|
|||||||
import tempfile
|
import tempfile
|
||||||
import urllib.request
|
import urllib.request
|
||||||
import zipfile
|
import zipfile
|
||||||
|
from io import BytesIO
|
||||||
from os import path
|
from os import path
|
||||||
|
|
||||||
# --- Globals ----------------------------------------------
|
# --- Globals ----------------------------------------------
|
||||||
@ -75,7 +76,7 @@ def download_extract_replace(plugin_name, zip_path, temp_dir, source_dir):
|
|||||||
# Download and extract file in temp dir
|
# Download and extract file in temp dir
|
||||||
with urllib.request.urlopen(zip_path) as req:
|
with urllib.request.urlopen(zip_path) as req:
|
||||||
with open(temp_zip_path, "wb") as f:
|
with open(temp_zip_path, "wb") as f:
|
||||||
f.write(req.read())
|
f.write(BytesIO(req.read()))
|
||||||
zip_f = zipfile.ZipFile(temp_zip_path)
|
zip_f = zipfile.ZipFile(temp_zip_path)
|
||||||
zip_f.extractall(temp_dir)
|
zip_f.extractall(temp_dir)
|
||||||
content_disp = req.headers.get("Content-Disposition")
|
content_disp = req.headers.get("Content-Disposition")
|
||||||
|
Loading…
Reference in New Issue
Block a user