This package is part of the @shapediver/viewer
.
It is used to expand the format property of the ShapeDiver file parameters.
Additionally, it can be used to to find additional mime-types for provided file endings.
npm install @shapediver/viewer.utils.mime-type
Returns an extended array of mime types. The provided mime types are are mapped to file endings and the corresponding mime types are added. The types are filtered to only contain unique values.
Example:
import { extendMimeTypes } from "@shapediver/viewer.utils.mime-type"
const currentFormats = ['application/dxf', 'application/x-autocad'];
const completeFormats = extendMimeTypes(currentFormats);
Try to guess mime types from a file name
Example:
import { guessMimeTypeFromFilename } from "@shapediver/viewer.utils.mime-type"
const types = guessMimeTypeFromFilename(fileName);
Returns the corresponding file endings for each mime type.
Example:
import { mapMimeTypeToFileEndings } from "@shapediver/viewer.utils.mime-type"
const currentFormats = ['model/vnd.sdtf'];
const fileEndings = mapMimeTypeToFileEndings(currentFormats);