mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 01:00:29 +08:00
msd: ftruncate() for uploading
This commit is contained in:
parent
c02bc53bc4
commit
47778bc48c
@ -271,6 +271,7 @@ class MsdFileWriter(BaseMsdWriter): # pylint: disable=too-many-instance-attribu
|
|||||||
get_logger(1).info("Writing %r image (%d bytes) to MSD ...", self.__name, self.__file_size)
|
get_logger(1).info("Writing %r image (%d bytes) to MSD ...", self.__name, self.__file_size)
|
||||||
await aiofiles.os.makedirs(os.path.dirname(self.__path), exist_ok=True)
|
await aiofiles.os.makedirs(os.path.dirname(self.__path), exist_ok=True)
|
||||||
self.__file = await aiofiles.open(self.__path, mode="w+b", buffering=0) # type: ignore
|
self.__file = await aiofiles.open(self.__path, mode="w+b", buffering=0) # type: ignore
|
||||||
|
await aiotools.run_async(os.ftruncate, self.__file.fileno(), self.__file_size) # type: ignore
|
||||||
return self
|
return self
|
||||||
|
|
||||||
async def finish(self) -> bool:
|
async def finish(self) -> bool:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user