How to use the mime/lite.define function in mime

To help you get started, we’ve selected a few mime examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github webiny / webiny-js / packages / webiny-admin / src / components / FileManager / BottomInfoBar.js View on Github external
// @flow
import React from "react";
import mime from "mime/lite";
import styled from "react-emotion";
import SupportedFileTypes from "./BottomInfoBar/SupportedFileTypes";
import UploadStatus from "./BottomInfoBar/UploadStatus";

mime.define({ "image/x-icon": ["ico"] }, true);
mime.define({ "image/jpg": ["jpg"] }, true);
mime.define({ "image/vnd.microsoft.icon": ["ico"] }, true);

const BottomInfoBarWrapper = styled("div")({
    fontSize: "0.8rem",
    position: "sticky",
    bottom: 0,
    height: 30,
    color: "var(--mdc-theme-text-secondary-on-background)",
    borderTop: "1px solid var(--mdc-theme-on-background)",
    backgroundColor: "var(--mdc-theme-surface)",
    width: "100%",
    transform: "translateZ(0)",
    overflow: "hidden",
    display: "flex",
    alignItems: "center",
    zIndex: 1,
github webiny / webiny-js / packages / app-admin / src / components / FileManager / BottomInfoBar / SupportedFileTypes.js View on Github external
// @flow
import React from "react";
import mime from "mime/lite";

mime.define({ "image/x-icon": ["ico"] }, true);
mime.define({ "image/jpg": ["jpg"] }, true);
mime.define({ "image/vnd.microsoft.icon": ["ico"] }, true);

const getUniqueFileExtensions = accept => {
    const exts = {};
    accept.forEach(item => {
        exts[mime.getExtension(item)] = true;
    });

    return Object.keys(exts);
};

const SupportedFileTypes = ({ accept }: *) => {
    if (!accept) {
        return null;
    }