mimetype.ts 1.1 KB

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