rofinn / FilePathsBase.jl

Filesystem path types in julia
Other
82 stars 17 forks source link

`MethodError: no method matching skip(::FileBuffer, ::Int64)` #143

Closed omus closed 3 years ago

omus commented 3 years ago

The FileBuffer type support seeking but not the skip method:

julia> using EDF, FilePathsBase

julia> edf_path = p"test/data/test.edf"  # Working in EDF.jl root
p"test/data/test.edf"

julia> edf = EDF.read(FileBuffer(edf_path))
ERROR: MethodError: no method matching skip(::FileBuffer, ::Int64)
Closest candidates are:
  skip(::Base.GenericIOBuffer, ::Integer) at iobuffer.jl:243
  skip(::IOStream, ::Integer) at iostream.jl:184
  skip(::Base.Filesystem.File, ::Integer) at filesystem.jl:232
  ...
Stacktrace:
 [1] read_file_header(io::FileBuffer)
   @ EDF ~/.julia/dev/EDF/src/read.jl:99
 [2] EDF.File(io::FileBuffer)
   @ EDF ~/.julia/dev/EDF/src/read.jl:200
 [3] read(io::FileBuffer)
   @ EDF ~/.julia/dev/EDF/src/read.jl:275
 [4] top-level scope
   @ REPL[5]:1

Originally noticed this when working with S3Paths:

edf = open(edf_path, "r") do io
    EDF.read(io)  # When `edf_path::S3Path` then `io::FileBuffer`
end