Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

automatic mimetypes in javascript node.js

I'm uploading files to aws s3 in javascript, and AFAIK they all need a mimetype to function correctly. Is there a script that automatically maps filenames to mimetypes that I could use?

Edit: If there's a way for amazon to automatically handle the mimetypes that would be better.

like image 963
Mark Avatar asked Mar 15 '11 18:03

Mark


People also ask

What is MIME type in node JS?

The ultimate javascript content-type utility. Similar to the [email protected] module, except: No fallbacks. Instead of naively returning the first available type, mime-types simply returns false , so do var type = mime.

Can you code JavaScript in node JS?

Node.js allows you to run JavaScript on the server.

How does JavaScript run in node JS?

Both your browser JavaScript and Node. js run on the V8 JavaScript runtime engine. This engine takes your JavaScript code and converts it into a faster machine code. Machine code is low-level code which the computer can run without needing to first interpret it.


1 Answers

https://github.com/broofa/node-mime is a decent looking library for automatic mime lookups.

like image 110
Zikes Avatar answered Oct 02 '22 04:10

Zikes