我的程序特定的二进制文件应使用哪种 MIME 类型?

发布于 2024-11-25 12:51:46 字数 110 浏览 2 评论 0原文

我的程序使用它自己的二进制文件类型,所以我假设我不能使用 MIME 类型文本/纯文本,因为它不是 7 位 ASCII 文件。

我应该将其称为“application/myappname”吗?

My program uses its own binary file type, so I assume I can't use MIME type text/plain, as it is not a 7-bit ASCII file.

Should I just call it "application/myappname"?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

幻想少年梦 2024-12-02 12:51:46

我推荐 application/octet-stream 因为 RFC2046 说“The ” “八位字节流”子类型用于指示主体包含任意二进制数据”和“对于接收“应用程序/八位字节流”实体的实现的建议操作是简单地将数据放入 文件[...]”。

我认为这样你就能更好地处理任意程序,这些程序在遇到你未知的 mime 类型时可能会呕吐。

I'd recommend application/octet-stream as RFC2046 says "The "octet-stream" subtype is used to indicate that a body contains arbitrary binary data" and "The recommended action for an implementation that receives an "application/octet-stream" entity is to simply offer to put the data in a file[...]".

I think that way you will get better handling from arbitrary programs, that might barf when encountering your unknown mime type.

月下伊人醉 2024-12-02 12:51:46

你也许可以使用:

application/x-binary

什么是 MIME 类型

mime 类型列表

查看说明

you could perhaps use:

application/x-binary

what is MIME types

list of mime types

see explanation

半夏半凉 2024-12-02 12:51:46

mimetype 标头被浏览器识别,以便(快速)可能识别处理程序以使用下载的文件作为目标,例如,将下载 PDF,并使用 PDF 文件的路径执行您的 Adob​​e Reader 程序一个论点,

如果您需要编写一个浏览器扩展来通过操作系统处理下载的文件,或者您只是想让您的项目看起来更“专业”,请继续选择一个独特的 mimetype 供您使用,
如果

您想确保将下载文件看看这个答案:https://stackoverflow.com/a/34758866/257319

如果你想让你的文件类型特别有条理,可能值得在文件的前几个字节中添加一些字母,例如,每个 JPG 在其文件开头都有这样的内容:

如果您能承受 4 或 8 个字节的跳转,那么它可能对您在 剩下的事情

:)

mimetype headers are recognised by the browser for the purpose of a (fast) possible identifying a handler to use the downloaded file as target, for example, PDF would be downloaded and your Adobe Reader program would be executed with the path of the PDF file as an argument,

If your needs are to write a browser extension to handle your downloaded file, through your operation-system, or you simply want to make you project a more 'professional looking' go ahead and select a unique mimetype for you to use,
it would make no difference since the operation-system would have no handle to open it with (some browsers has few bundled-plugins, for example new Google Chrome versions has a built-in PDF-reader),

if you want to make sure the file would be downloaded have a look at this answer: https://stackoverflow.com/a/34758866/257319

if you want to make your file type especially organised, it might be worth adding a few letters in the first few bytes of the file, for example, every JPG has this at it's file start:

if you can afford a jump of 4 or 8 bytes it could be very helpful for you in the rest of the way

:)

梦罢 2024-12-02 12:51:46

根据规范RFC 2045 #Content-Type 标头字段的语法 application/myappname 是不允许的,但 application/x-myappname 是允许的,对我来说听起来最适合您的应用程序。

According to the specification RFC 2045 #Syntax of the Content-Type Header Field application/myappname is not allowed, but application/x-myappname is allowed and sounds most appropriate for your application to me.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文