Get File MIME Type from Command Line
I've gotten skilled at shell scripting over the years. I love a good GUI but knowing how to automate makes you a much more powerful engineer. Much of my scripting requires recursing over directories and processing a file if it meets a given criteria, which is often file extension or MIME type.
You can use the following shell command to get a file's MIME type:
file --mime-type -b Downloads/main.js
# text/plain
file --mime-type -b Downloads/logo.jpg
# image/jpeg
It's important to use the brief (-b
) option in the command or you may receive an error message.
MIME type is used for validation and any number of other informational use cases. Luckily the file
command and and a flag is all you need!
David asked me if I'd be up for a guest post picking out some of my favorite Pens from CodePen. A daunting task! There are so many! I managed to pick a few though that have blown me away over the past few months. If you...
One major problem with creating UI components with the MooTools JavaScript framework is that there isn't a great way of allowing customization of template and ease of node creation. As of today, there are two ways of creating:
new Element Madness
The first way to create UI-driven...
It's something that makes all men live in fear, and are often uncertain of. It's never spoken, but the curiosity is always there. Nine out of ten women agree in the affirmative. Advertisers do their best to make us feel inadequate but...
Google recently introduced an interesting effect to their homepage: the top left and top right navigation items don't display until you move your mouse or leave the search term box. Why? I can only speculate that they want their homepage as...