Skip to content

Commit b41eb09

Browse files
authored
Use RangeStream when writing a block to ASDF (#28)
1 parent 87c00bd commit b41eb09

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

dissect/evidence/asdf/asdf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
from dissect import cstruct
1515
from dissect.util import ts
16-
from dissect.util.stream import AlignedStream
16+
from dissect.util.stream import AlignedStream, RangeStream
1717

1818
from dissect.evidence.asdf.streams import CompressedStream, Crc32Stream, HashedStream
1919
from dissect.evidence.exceptions import (
@@ -311,8 +311,8 @@ def _write_block(self, source: BinaryIO, offset: int, size: int, idx: int = 0, b
311311
block.write(self.fh)
312312
data_offset = self.fh.tell() # Block data location
313313

314-
source.seek(offset)
315-
shutil.copyfileobj(source, outfh, size)
314+
source_stream = RangeStream(source, offset, size)
315+
shutil.copyfileobj(source_stream, outfh)
316316
# This writes any remaining data or footer for each block writer
317317
outfh.finalize()
318318

0 commit comments

Comments
 (0)