Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using read(::FileBuffer, nb) returns no data on first read #126

Closed
omus opened this issue Aug 16, 2021 · 1 comment · Fixed by #140
Closed

Using read(::FileBuffer, nb) returns no data on first read #126

omus opened this issue Aug 16, 2021 · 1 comment · Fixed by #140

Comments

@omus
Copy link
Contributor

omus commented Aug 16, 2021

julia> using FilePathsBase

julia> write("test.txt", "testing")
7

julia> io = FilePathsBase.FileBuffer(Path("test.txt"))
FileBuffer(p"test.txt", IOBuffer(data=UInt8[...], readable=true, writable=true, seekable=true, append=false, size=0, maxsize=Inf, ptr=1, mark=-1), true, false, false)

julia> read(io, 3)
UInt8[]

julia> read(io, 3)
UInt8[]

julia> read(io, UInt8)
0x74

julia> read(io, 3)
3-element Vector{UInt8}:
 0x65
 0x73
 0x74
@omus
Copy link
Contributor Author

omus commented Aug 18, 2021

The current work around for this is:

io = IOBuffer(read(Path("test.txt")))

This is effectively what is happening internally with FileBuffer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant