From d55307226c14fba82ec7242c2850654223aa89ac Mon Sep 17 00:00:00 2001 From: Jadson Lucena Date: Wed, 8 Jun 2022 10:16:54 -0300 Subject: [PATCH] docs: interfaces --- README.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/README.md b/README.md index d0362f6..59bffe2 100644 --- a/README.md +++ b/README.md @@ -4,3 +4,42 @@ This is a comprehensive compilation of MIME types that is periodically updated t ## What is A file's extension has no meaning on the web. In order for the client to interpret the document correctly, the MIME type must be sent in the Content-Type header. + + +## Interfaces +```typescript +// Constructor +constructor( + updateInterval?: number = 86400000 // The time, in milliseconds. if less than zero, periodic update will be disabled. +) +``` + +```typescript +// Getters +list(): { [mimeType: string]: string[] } // List of all MIME types with their extensions +updateInterval(): number +``` + +```typescript +// Setters +updateInterval( + updateInterval?: number = 86400000 // https://developer.mozilla.org/en-US/docs/Web/API/setInterval#delay +) +``` + +```typescript +// Methods +append( + mimeType: string, // https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types#structure_of_a_mime_type + extension: string | string[] // new RegExp('^[a-z0-9-_+.~%]+$', 'i'); +) + +get( + path: string // https://nodejs.org/api/path.html#pathparsepath +): string[] // MIME type list +``` + +```typescript +// Listeners +on(name: 'updated', callback: (mimeType: string, extensions: string[]) => void): void +```