Skip to content

Commit

Permalink
docs: update for the new interface
Browse files Browse the repository at this point in the history
  • Loading branch information
JadsonLucena committed Mar 23, 2023
1 parent ac34355 commit 5215158
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# MediaTypes
This is a comprehensive compilation of media types that is periodically updated through the following projects: [Apache](https://github.com/apache/httpd/blob/trunk/docs/conf/mime.types), [NGINX](https://github.com/nginx/nginx/blob/master/conf/mime.types), [IANA](https://www.iana.org/assignments/media-types/media-types.xhtml) and [Debian](https://salsa.debian.org/debian/media-types/-/blob/master/mime.types)
This is a comprehensive compilation of media types that is periodically updated through the following projects: [Apache](https://github.com/apache/httpd/blob/trunk/docs/conf/mime.types), [NGINX](https://github.com/nginx/nginx/blob/master/conf/mime.types) and [Debian](https://salsa.debian.org/debian/media-types/-/blob/master/mime.types)


## What is
Expand All @@ -16,7 +16,7 @@ constructor(

```typescript
// Getters
list(): { [mediaType: string]: string[] } // List of all media types with their extensions
list(): { [extension: string]: string[] } // List of all extensions with their media types
updateInterval(): number
```

Expand All @@ -29,21 +29,26 @@ updateInterval(

```typescript
// Methods
append(
delete(
extension: string
mediaType: string | string[], // https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types#structure_of_a_mime_type
)
) string[] // Deleted media type list

get(
path: string // https://nodejs.org/api/path.html#pathparsepath
): string[] // media type list
): string[] // Media type list

set(
extension: string
mediaType: string | string[], // https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types#structure_of_a_mime_type
) string[] // Inserted media type list

update(): void // database update
update(): { [extension: string]: string[] } // List of new types of media inserted
```

```typescript
// Listeners
on(name: 'update', callback: (mimeType: string, extensions: string[]) => void): void
on(name: 'update', callback: (list: { [extension: string]: string[] }) => void): void
```


Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@jadsonlucena/mediatypes",
"version": "0.1.0",
"description": "This is a comprehensive compilation of media types that is periodically updated through the following projects: Apache, NGINX, IANA and Debian",
"description": "This is a comprehensive compilation of media types that is periodically updated through the following projects: Apache, NGINX and Debian",
"main": "./src/MediaTypes.js",
"engines": {
"node": ">=18"
Expand Down

0 comments on commit 5215158

Please sign in to comment.