/
mimetype.ts
47 lines (43 loc) · 1.37 KB
/
mimetype.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
import * as nbformat from '@jupyterlab/nbformat';
/**
* The mime type service of a code editor.
*/
export interface IEditorMimeTypeService {
/**
* Get a mime type for the given language info.
*
* @param info - The language information.
*
* @returns A valid mimetype.
*
* #### Notes
* If a mime type cannot be found returns the default mime type `text/plain`, never `null`.
* There may be more than one mime type, but only the first one will be returned.
* To access all mime types, use `IEditorLanguageRegistry` instead.
*/
getMimeTypeByLanguage(info: nbformat.ILanguageInfoMetadata): string;
/**
* Get a mime type for the given file path.
*
* @param filePath - The full path to the file.
*
* @returns A valid mimetype.
*
* #### Notes
* If a mime type cannot be found returns the default mime type `text/plain`, never `null`.
* There may be more than one mime type, but only the first one will be returned.
* To access all mime types, use `IEditorLanguageRegistry` instead.
*/
getMimeTypeByFilePath(filePath: string): string;
}
/**
* A namespace for `IEditorMimeTypeService`.
*/
export namespace IEditorMimeTypeService {
/**
* The default mime type.
*/
export const defaultMimeType: string = 'text/plain';
}