0.0.5 • Published 2 years ago
mime-icons v0.0.5
MIME icons
Give an icon to a web resource file by Content-Type or url subfix.
Usage
npm install mime-iconsFirst, MUST copy icons folder to your project's public files path.
Now, import module, with getIconName function, you will get the target icon name. The function get 2 optional parameters:
| parameter | from |
|---|---|
| contentType | HTTP response header's Content-Type |
| url | resource url |
example:
import mime from "mime-icons";
const icon = mime.getIconName({
contentType: "text/html",
url: "http://xxx.com/index.html",
});
const imagePath = env.PUBLIC_PATH + "/icons/" + icon;Example
git clone https://github.com/DeronW/mime-icons
cd mime-icons/demo
npm i
npm run dev
# open http://localhost:5173Resources
Thanks to apache for content-type and file extensions mapping, and vscode-icons for extensions icons.
customize
Some files has common extension, use common use case overwrite it, such as js, css, html and soon.
0.0.5
2 years ago
0.0.4
2 years ago
0.0.3
2 years ago
0.0.2
2 years ago
0.0.1
2 years ago
0.0.0-alpha-2
2 years ago
0.0.0-alpha
2 years ago