You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm implementing a service using reactphp/filesystem that allows for data transfer supporting resume operations. In order to accomplish this, I need to be able to seek() to a particular offset in the file.
I've found that the Adapter::read method contains a reference to the offset, passed in as the third parameter.
However, this $offset seems to only be used internally by the ReadableStreamTrait class, by keeping a reference to the current readCursor and incrementing this by chunkSize each read operation.
Is there any way to set the reacCursor position manually or do I need to look into using the Adapter / filesystem class directly? Would it be worth adding a new method to the ReadableStreamTrait to set the readCursor directly in order to set the offset?
The text was updated successfully, but these errors were encountered:
@tomfite Thanks for reporting, I agree this should be supported and exposed by our APIs! 👍
It looks like this is exposed by AdapterInterface::read() and AdapterInterface::getContents() recently introduced via #62, but not FilesystemInterface::getContents(). This means you should be able to pass this offset to seek to a specific position already. We're working towards more consistent APIs with #46, PRs to help with this are always very much appreciated! 👍
I'm implementing a service using
reactphp/filesystem
that allows for data transfer supporting resume operations. In order to accomplish this, I need to be able toseek()
to a particular offset in the file.I've found that the
Adapter::read
method contains a reference to the offset, passed in as the third parameter.However, this
$offset
seems to only be used internally by theReadableStreamTrait
class, by keeping a reference to the currentreadCursor
and incrementing this bychunkSize
each read operation.Is there any way to set the
reacCursor
position manually or do I need to look into using theAdapter
/ filesystem class directly? Would it be worth adding a new method to the ReadableStreamTrait to set thereadCursor
directly in order to set the offset?The text was updated successfully, but these errors were encountered: