A ContentTypeParser attempts to return the mime type of a given file. It receives the first chunk of the file data and the file name, if it is available. The function can be sync or async and if it returns/resolves to undefined, application/octet-stream will be used.

interface ContentTypeParser ((bytes, fileName?) => undefined | string | Promise<undefined | string>)
  • Attempt to determine a mime type, either via of the passed bytes or the filename if it is available.

    Parameters

    Returns undefined | string | Promise<undefined | string>