MIME type for a directory

On Ubuntu, a directory mimetype is inode/directory If you run, on Ubuntu: $ mimetype /home/<your username> /home/<your username>: inode/directory There is a “text/directory” in the IANA standards (http://www.rfc-editor.org/rfc/rfc2425.txt and http://www.iana.org/assignments/media-types/text) but it was marked “deprecated”.

Flask request and application/json content type

Use request.get_json() and set force to True: @menus.route(“https://stackoverflow.com/”, methods=[“PUT”, “POST”]) def new(): return jsonify(request.get_json(force=True)) From the documentation: By default this function will only load the json data if the mimetype is application/json but this can be overridden by the force parameter. Parameters: force – if set to True the mimetype is ignored. For older Flask … Read more

How can I get MIME type of an InputStream of a file that is being uploaded?

I wrote my own content-type detector for a byte[] because the libraries above weren’t suitable or I didn’t have access to them. Hopefully this helps someone out. // retrieve file as byte[] byte[] b = odHit.retrieve( “” ); // copy top 32 bytes and pass to the guessMimeType(byte[]) funciton byte[] topOfStream = new byte[32]; System.arraycopy(b, … Read more