Git Product home page Git Product logo

Comments (3)

up209d avatar up209d commented on June 14, 2024

@jaegertros Hey bro, I am not sure what would you want to achieve? Could you clarify it with more details, maybe I can help :D

from resourcessaverext.

jaegertros avatar jaegertros commented on June 14, 2024

@up209d appreciate the quick response! I am using your extension to help with my thesis research so I can grab articles and related stuff from pages, so super helpful (more so than just saving the article or whatever itself). The filenames default to "all.zip" in the "All Resources" folder of downloads. I was hoping to have it default to always naming the zip file after the URL where it was gotten from. I didn't know how Windows would handle it if the extension tried to use invalid filepath characters, and I was trying to show an attempt at cleaning that up. But honestly, it doesn't make a difference to me if the characters are just removed or replaced by anything else. It would just save me a lot of time trying to manually clean up the url name and then renaming the zip files or also save me from this "all (68).zip" mess that I am making for myself.

For example, if I saved this page:

currently - all.zip

hopeful for - anything along these lines
httpsgithub.comup209dResourcesSaverExtissues18.zip
https github com up209d ResourcesSaverExt issues 18.zip
github.com_up209d_ResourcesSaverExt_issues_18.zip

from resourcessaverext.

up209d avatar up209d commented on June 14, 2024

@jaegertros hey bro, you might need to take the tab url first like this

function downloadCompleteZip(blobWriter, callback) {
  blobWriter.close(function (blob) {
  chrome.tabs.get(
    chrome.devtools.inspectedWindow.tabId, function (tab) {
      var filename = tab.url.replace(/(\||\/|\:|\*|\"|\<|\>|\\)/g,"_"); 
      chrome.downloads.download({
        url: URL.createObjectURL(blob),
        filename: 'All Resources/' + filename + '.zip',
        saveAs: false
      }, function () {
        if (chrome.runtime.lastError) {
          callback(false);
        } else {
          callback(true);
        }
      });
    });
  })
}

from resourcessaverext.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.