0

I am frequently downloading large files in my browser (Chrome on Mac). I'd like to be able to shut down my computer and continue the download. Currently, I halt the download, scp the incomplete file over to my RPI, copy the download URL from Chrome://downloads, ssh to my RPI and do wget -c '#url' -O 'file'. Then, next day, I scp the file over. This is kind of too complicated. Is there a simple way (plugin?) to just directly trigger the download on my RPI? Maybe Chrome talking to Chromium?


What i'm doing currently (status quo)

var h=require('http');
var wget = require('node-wget');
var url = require('url');

var server=h.createServer(function (req, res) {

    setTimeout(function () {
      var url_parts = url.parse(req.url, true);
      var query = url_parts.query;
      var u = query.u;
      wget(''+u+'');
      res.writeHead(200, {'Content-Type': 'text/plain'});
      res.end(u+' received');
    }, 100);


});
server.listen(1200);

and 'Custom right-click menu extension for chrome'

var query;
var url = "http://127.0.0.1:1200/?u=%s";
if (crmAPI.getSelection()) {
    query = crmAPI.getSelection();
} else {
    query = window.prompt('Please enter a search query');
}
if (query) {
    window.open(url.replace(/%s/g,query), '_blank');
}
1

You can use this script with this plugin https://chrome.google.com/webstore/detail/downloaders/lfjamigppmepikjlacjdpgjaiojdjhoj/

C:\path\to\ssh.exe local@host.com && cd "/where/to/download" && wget -c --referer="%r" "%u"

You will need to setup up key-based logins with no password on your Pi.

  • will try this. sounds like a good idea :) – user2707001 Apr 22 '17 at 12:21
  • @user2707001 I only problem I can see is when you try to download a login protected file, in which case you need to download the file manually with this and wget --options --load-cookies="/path/to/cookies.txt" – Michael Wilcox Apr 22 '17 at 12:30
  • Cannot get the script to work unfortunately. Is there a trick? It just does nothing. – user2707001 Apr 22 '17 at 13:08
  • @user2707001 try again after doing this: tecmint.com/… – Michael Wilcox Apr 23 '17 at 15:58
  • that's not the issue; the chrome script doesn't work - it just does nothing. My ssh etc. pp. is just fine – user2707001 Apr 23 '17 at 20:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.