GoogleChromeLabs / browser-fs-access

File System Access API with legacy fallback in the browser
https://googlechromelabs.github.io/browser-fs-access/demo/
Apache License 2.0
1.38k stars 84 forks source link

Purpose of `opts.extensions`? #23

Closed dwelle closed 3 years ago

dwelle commented 3 years ago

When calling fileOpen, AFAIK the extensions doesn't really do anything on top of mimeTypes. At least on Windows (via Excalidraw) it does not.

What is it supposed to do, and why do/should we supply both mimeTypes and extensions?

tomayac commented 3 years ago

Some operating systems support extensions, some support MIME types, and some support both. It’s a recommended best practice to supply both for maximum compatibility. For example:

.jpeg, .jpg image/jpeg

We have the same behavior in the <input type=file> element: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#attr-accept.

dwelle commented 3 years ago

Thanks. I was also wrong it doesn't do anything, Excalidraw was just on an older version.