Skip to content

Commit

Permalink
docs: interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
JadsonLucena committed Mar 23, 2023
1 parent 87b8ccd commit d553072
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

0 comments on commit d553072

Please sign in to comment.