kopia lustrzana https://github.com/micropython/micropython-lib
upip: Update utarfile module, readinto() support.
rodzic
31c4957ec5
commit
7b3a2c0a42
|
@ -35,6 +35,15 @@ class FileSection:
|
|||
self.content_len -= sz
|
||||
return data
|
||||
|
||||
def readinto(self, buf):
|
||||
if self.content_len == 0:
|
||||
return 0
|
||||
if len(buf) > self.content_len:
|
||||
buf = memoryview(buf)[:self.content_len]
|
||||
sz = self.f.readinto(buf)
|
||||
self.content_len -= sz
|
||||
return sz
|
||||
|
||||
def skip(self):
|
||||
self.f.read(self.content_len + self.align)
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue