title: Steam Workshop Downloader w/ TamperMonkey and GM_xmlhttpRequest - file is always ~1.85 times larger and corrupt-using window url and it downloads fine
body: <p>I have been playing around with several Steam Workshop downloaders but none of them worked to my liking, required a thirdparty site, or just didn't work at all... None of the ones I found actually worked for downloading entire collections.</p>
  
  <p>So, I modified one the other day and got it close to where I am today. Unfortunately TamperMonkey decided to auto-update despite having updates disabled / notify only unless something else happened which deleted all of my progress so I decided to write one from scratch with some help from some of the others for URLs, etc... ( Although I did create a Lua steam api for Garry's Mod )...</p>
  
  <p>Anyway, right now.. where I'm at is when I download using window.location.href or window.open - it downloads perfectly ( although the files are compressed 2 times.. once needing to extract with 7zip then the gma comes out of that and 9/10 times that has to be renamed to .gma to extract that ).... Aside from that annoyance, no issues with that ( although I do want to automate extracting, at least so the main file is there )...</p>
  
  <p>But, if I use the "ajax" ie GM_xmlhttpRequest with progress bar ( all of that works properly ) and all of the file-sizes report correctly.. But, when I save the file either using: saveAs using: <a href="https://raw.githubusercontent.com/eligrey/FileSaver.js/master/FileSaver.js" rel="nofollow">https://raw.githubusercontent.com/eligrey/FileSaver.js/master/FileSaver.js</a> OR if I use the basic "hack"</p>
  
  <pre><code>var _datatype = ( !_type ) ? 'application/octet-stream' : _type;
  var _data = new Blob( [_content], { 'type':_datatype} );
  var _anchor = document.createElement( 'a' );
  _anchor.href = window.URL.createObjectURL( _content );
  _anchor.download = _filename;
  _anchor.click( );
  </code></pre>
  
  <p>They both provide the same result where the file-size seems to be multiplied by 1.85 to 1.86 what it should be.</p>
  
  <p>I have tried many different header combos, even read the header data from the site and replicated everything I could think of... Nothing seems to work.</p>
  
  <p>For the time being I added a _override var to enable AJAX / Tabs download methods to be active at the same time if AJAX is enabled. If tabs method is enabled then it only shows that one... This is for testing and at the end I may end up removing that so the user can choose whichever method they prefer and be done with it.</p>
  
  <p>I prefer the progress bar method because having 100 tabs open up is annoying and can cause other issues where-as with the progress bar it doesn't seem to happen...</p>
  
  <p>I created a simple collection for testing purposes: <a href="http://steamcommunity.com/sharedfiles/filedetails/?id=729040851" rel="nofollow">http://steamcommunity.com/sharedfiles/filedetails/?id=729040851</a></p>
  
  <p>and have been downloading this item by itself: <a href="http://steamcommunity.com/sharedfiles/filedetails/?id=508933184" rel="nofollow">http://steamcommunity.com/sharedfiles/filedetails/?id=508933184</a></p>
  
  <p>I have tried on other collections, etc.. and all of them have the same result which is why I am sticking with the smaller collection and item for the time being.</p>
  
  <p>The plant models are supposed to be 2,796KB but downloads as 5,199KB via ajax and properly at 2,796KB with tab method. Flip Off is 106KB but ajax downloads at 196KB. Etc... All of the ones I have tried are within the range of 1.85 yo 1.86 multiple inclusive.</p>
  
  <p>The ultimate plan once this is working is to release it to the community for free to use and to learn from. But, right now I'm stuck and any help is appreciated.</p>
  
  <p>Here is the full script, and a link to "snippets" which have been tried and deleted out of the main script to remain "clean"...</p>
  
  <p><a href="https://dl.dropboxusercontent.com/u/26074909/acecool_web_utilities/steam_workshop_downloader/Acecool-SteamWorkshopDownloader.js" rel="nofollow">https://dl.dropboxusercontent.com/u/26074909/acecool_web_utilities/steam_workshop_downloader/Acecool-SteamWorkshopDownloader.js</a></p>
  
  <p><a href="https://dl.dropboxusercontent.com/u/26074909/acecool_web_utilities/steam_workshop_downloader/snippets.js" rel="nofollow">https://dl.dropboxusercontent.com/u/26074909/acecool_web_utilities/steam_workshop_downloader/snippets.js</a></p>
  
  <p>I left the FileSaver in there despite it having the same result. I've tried Blob, base content, headers, different "hacks" etc... nothing I've tried seems to work and I have looked all over... Again, thanks for any help provided!</p>