feat: merge geekan:cli-etc

This commit is contained in:
莘权 马 2023-11-29 20:12:03 +08:00
parent 7b44fccf8d
commit 94043a89f4
3 changed files with 14 additions and 17 deletions

View file

@ -54,7 +54,7 @@ class FileRepository:
"""
pathname = self.workdir / filename
pathname.parent.mkdir(parents=True, exist_ok=True)
async with aiofiles.open(str(pathname), mode="wb") as writer:
async with aiofiles.open(str(pathname), mode="w") as writer:
await writer.write(content)
logger.info(f"save to: {str(pathname)}")
@ -98,7 +98,7 @@ class FileRepository:
if not path_name.exists():
return None
try:
async with aiofiles.open(str(path_name), mode="rb") as reader:
async with aiofiles.open(str(path_name), mode="r") as reader:
doc.content = await reader.read()
except FileNotFoundError as e:
logger.info(f"open {str(path_name)} failed:{e}")