Page 1 of 1

Is it possible to unset a mime type?

Posted: Tue Feb 25, 2020 2:59 pm
by ksharindam
When I download something in chromium browser it adds crdownload extension while downloading. So i can not double click a file and open it until the downloading has finished.
So I want to unset that mimetype. So that, the file type will be correctly detected by its magick number, and I will be able to open it in a program.
Is it possible to do that? Or can I disable adding crdownload extension in chromium?

Re: Is it possible to unset a mime type?

Posted: Tue Feb 25, 2020 3:48 pm
by B.Goode
I don't have an answer to your question.

But I can suggest that as an alternative you consider downloading the file with a dedicated tool such as wget or curl.

Re: Is it possible to unset a mime type?

Posted: Wed Feb 26, 2020 3:27 am
by ksharindam
I can not use wget or some other download managers, because some downloads can not be started separately in a download manager. May be the site requires cookies or something else to start download.

Re: Is it possible to unset a mime type?

Posted: Wed Feb 26, 2020 5:24 am
by kerry_s
it does the crdownload meaning it's still downloading it, you want to open before the download is finished? as in incomplete download, it's not on your computer yet till it's finished.

anyways what you can do is start the download, then cancel it, the link in the show all should be a direct link to what ever your trying to download.
here's my wget script gui, in case you want to try that.

Code: Select all

#!/bin/sh

link=`zenity --entry --title="wget download" --text="file to download" --width=500`
cd ~/Downloads
wget $link 2>&1 | sed -u 's/.* \([0-9]\+%\)\ \+\([0-9.]\+.\) \(.*\)/\1\n# Downloading at \2\/s, ETA \3/' | zenity --progress --title="Downloading" --width=500 --auto-close --auto-kill

zenity=0
while [ $zenity -eq 0 ]
do
if [ -z "$(pidof zenity)" ]
then
  pkill wget
  zenity=1
fi
done

exit 0


Re: Is it possible to unset a mime type?

Posted: Wed Feb 26, 2020 2:16 pm
by ksharindam
I know how to use wget. But some download requires cookies, so if I copy the link and try to download in wget, the download does not start.
Hence, I must have to download in chromium.

Re: Is it possible to unset a mime type?

Posted: Wed Feb 26, 2020 2:36 pm
by rpdom
wget can use cookies. If you can get at the cookie details from your browser you can save those into a file and tell wget to use them.

Re: Is it possible to unset a mime type?

Posted: Wed Feb 26, 2020 4:00 pm
by DougieLawson
How about lynx. That's a fully-fledged text browser which sometimes works until the site you're visiting needs javascript to work properly. Lynx has support for cookies and can store them in a cookie jar.

Re: Is it possible to unset a mime type?

Posted: Wed Feb 26, 2020 5:36 pm
by kerry_s
like he said, wget has a lot of settings "wget --help", never the less a .crdownload is an incomplete download.

Re: Is it possible to unset a mime type?

Posted: Thu Feb 27, 2020 5:40 pm
by ksharindam
I solved the problem by editing the file /usr/share/mime/packages/freedesktop.org.xml . and then deleted the line
<glob pattern="*.crdownload"/>
then ran command

Code: Select all

sudo update-mime-database /usr/share/mime
Now the file type is detected correctly by its magic number in a file manager.