Is there a way to import an edf file represented as bytes

I am attempting to parse edf files in parallel in spark and have loaded the files into a binaryfile dataframe. using

https://spark.apache.org/docs/3.0.0-preview/sql-data-sources-binaryFile.html

It seems mne.io.read_raw_edf only supports reading the actual files. i have tried using io.BytesIO and io.RawBaseIO and get the following error

TypeError: expected str, bytes or os.PathLike object, not RawIOBase

so i then tried just casting the bytearray form the dataframe as bytes, and get this error
NotImplementedError: Only EDF files are supported by read_raw_edf, got b’’

does anyone have any suggestions on how to get the edfs loaded into spark using the following method?

I’m pretty sure this is not easily possible without adapting the reader function to also accept a file-like (bytes-like) object in addition to a string (the file name). Is someone knows how to do that I’d be very interested!

we have done this in the past for fif files see

https://github.com/mne-tools/mne-python/blob/main/mne/io/open.py#L41:5

we could add this for EDF

Alex

@rla3rd has opened an issue with a feature request on GitHub: