Use aiofiles for image provider file writes

This commit is contained in:
miruka 2019-07-18 20:44:17 -04:00
parent 519d3610ef
commit 9decd58992
2 changed files with 4 additions and 3 deletions

View File

@ -13,6 +13,7 @@
- Refactoring
- Use .mjs modules
- SignIn/RememberAccount screens
- Don't bake in size properties for components
- Unfinished work in button-refactor branch
- Button can get "hoverEnabled: false" to let HoverHandlers work

View File

@ -9,7 +9,7 @@ from pathlib import Path
from typing import Tuple
from urllib.parse import urlparse
from atomicfile import AtomicFile
import aiofiles
from dataclasses import dataclass, field
from PIL import Image as PILImage
@ -108,8 +108,8 @@ class Thumbnail:
self.local_path.parent.mkdir(parents=True, exist_ok=True)
with AtomicFile(str(self.local_path), "wb") as file:
file.write(body)
async with aiofiles.open(self.local_path, "wb") as file:
await file.write(body)
return body