Skip to content

.bin extension files are served text/plain #219

Description

@jl

Files with .bin extension are usually served as application/octet-stream by most out-of-the-box web server and operating system configurations. This is useful for marking data as really binary data.

Example in golang:
https://cs.opensource.google/go/go/+/refs/tags/go1.26.4:src/mime/type.go;l=69

Currently, .bin files are served from pgs.sh as:

content-encoding: zstd
content-type: text/plain

I'm guessing it's from the GetMimeType function. It would be nice to add a case for .bin files:

func GetMimeType(fpath string) string {
	ext := strings.ToLower(filepath.Ext(fpath))
	switch ext {
	case ".bin":
		return "application/octet-stream"
	case ".svg":
		return "image/svg+xml"

In fact, GetMimeType() currently has no extensions which map to application/octet-stream.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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