1.0.1 • Published 3 months ago

@shapediver/viewer.utils.mime-type v1.0.1

Weekly downloads
-
License
polyform-noncomme...
Repository
github
Last release
3 months ago

@shapediver/viewer.utils.mime-type

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.

Install

npm install @shapediver/viewer.utils.mime-type

Usage

extendMimeTypes(mimeTypes: string[]): string[]

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);

guessMimeTypeFromFilename(filename: string): string[]

Try to guess mime types from a file name

Example:

import { guessMimeTypeFromFilename } from "@shapediver/viewer.utils.mime-type"

const types = guessMimeTypeFromFilename(fileName);

mapMimeTypeToFileEndings(mimeTypes: string[]): string[]

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);
1.0.1

3 months ago

1.0.0

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.0.10

2 years ago

0.0.11

2 years ago

0.0.12

2 years ago

0.0.13

2 years ago

0.0.14

2 years ago

0.1.0

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.0.15

2 years ago

0.0.9

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

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