Skip to content

fsspec loading #475

@sakshamgoyal-01

Description

@sakshamgoyal-01

Have you looked into adding fsspec as a dependency? It would allow opening files from any location, including remote files.

my use case:
I want to open msg files from an s3 bucket and extract the content from there. Right now I have to use workarounds to get it working.

def handle_msg(filename: Path | str) -> str:
    import extract_msg
    if isinstance(filename, str) and filename.startswith("s3:"):
        import s3fs
        s3 = s3fs.S3FileSystem()
        with s3.open(filename, 'rb') as f:
            content = f.read()
        msg = extract_msg.Message(io.BytesIO(content))
    else:
        msg = extract_msg.Message(filename)

Using fsspec would mean you can just use any URI to load a file (not just a local path)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions