Skip to content

Standardize content_type handling when writing files #916

@TomAugspurger

Description

@TomAugspurger

Would it be helpful to standardize the ability to set the content type of files written by fsspec? Several backends have / are requesting the ability to set this (https://github.com/fsspec/s3fs/blob/4f289eaa34dfe8337a72f5a0148c41a44793fde0/s3fs/core.py#L971-L974, fsspec/adlfs#294). Each backend will typically have a different "native" was for setting things. With S3 it's a ContentType keyword. With azure, it's content_settings=azure.storage.blob.ContentSettings(content_type=...).

This proposal would make content_type a proper keyword of pipe, put, (and any others writing data). The backend would be responsible for setting it appropriately.

We might also need to standardize a default behavior. s3fs uses a library to guess the content type. I'm not sure if that's appropriate (if it were, I'd think that boto / azure-storage-blob would do it?).

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