Download Router

← All AI-created software

This is AI-generated (aka vibe-coded) software. It is specific to my needs and my system and may not work for you or yours. Support is limited, but if you report a bug I'll certainly look into it. The code is provided in the zip file for you to review should you choose.
⬇️ Download Download Router.zip275.3 KBLast Updated: November 27, 2026Vivaldi

Download Router files downloads into subfolders automatically, based on the site they come from and what kind of file they are. Set a rule like huggingface.co → Models or .pdf → Documents, and matching downloads land in that folder instead of the general pile. It works in Vivaldi, Chrome, Edge, Brave and other Chromium browsers.

The full-page view: the rule form, four rules (one switched off), the backup schedule and recent activity
On this page

Install

  1. Open vivaldi://extensions (or chrome://extensions) and turn on Developer mode.
  2. Click Load unpacked and pick this folder.
  3. Pin the icon to the toolbar if you want one-click access.

After changing background.js or rules.js, press the reload arrow on the extension’s card. Changes to the interface take effect the next time you open it.

Using it

Click the toolbar icon for the popup, or open the full page: right-click the icon and choose Options, or press Open full page at the bottom of the popup. Both are the same interface. The full page shows all 50 activity entries instead of the latest six, and a file dialog can’t close it.

Rules

  • Add. Fill in a source domain (huggingface.co), file types (pdf, zip, tar.gz), or both, then a destination folder, and click Add Rule. The folder is inside your browser’s download folder and is created on first use.
  • Edit. Click Edit on a rule. The form fills in and the button reads Update Rule; Cancel Edit backs out.
  • Switch off. The checkbox at the left of a rule turns it off without deleting it. A switched-off rule is dimmed, keeps its place, and is skipped when a download arrives.
  • Delete. The red X removes a rule at once, without asking.
  • Replace files with the same name. Off (the default), a second report.pdf is saved as report (1).pdf. On, it overwrites the existing file with no prompt, and the old file doesn’t go to the trash. Programs and scripts (.exe, .msi, .dmg, .pkg, .sh, .bat, .ps1, .js, .lnk and the like) and files with no extension are never replaced, even with the box ticked, so no site can swap out an installer you already have.

How matching works

Enabled rules are tested in list order, and the first match wins. A rule with a domain only catches everything from that site. A rule with file types only shows as Any source and catches those types from anywhere. A rule with both needs both: github.com + zip routes only GitHub’s zips. Downloads that match nothing are left alone.

The domain is compared with the host the file actually comes from, after redirects, ignoring case. A rule for github.com matches github.com and its subdomains, but not evil.net/github.com/setup.exe or github.com.evil.net, so another site can’t drop a file into a folder you set aside for a site you trust. As a result:

  • A rule names a whole domain: hub.co does not match github.com.
  • A leading https://, *. or a port is ignored. A path, as in github.com/someorg, narrows the rule to addresses whose path starts with it.
  • The page that linked to the file doesn’t count. The one exception is a data: download, which has no host of its own and is matched by the page it came from.
  • A download that ends up on a CDN needs a rule for the CDN. GitHub release files, for example, come from githubusercontent.com.
  • There’s no way to reorder rules, so when two could match, the older one wins. Delete a rule and add it again to move it to the end.

File types are matched against the end of the file name, so tar.gz works. Dots and case don’t matter: PDF, .pdf and pdf are the same. A file named just pdf, with no extension, doesn’t match.

Folders can be nested (AI/Models). Before use, backslashes become forward slashes, : * ? " < > | are removed, .. is removed so a rule can’t leave the download folder, and stray slashes are trimmed. If nothing is left, the download is saved normally.

Recent activity

The list records the last 50 downloads, plus up to 50 older ones that replaced a file (so a burst of downloads can’t push those out), with the file, the site it came from, where it was saved and which rule matched, or No rule matched. Only the site’s host name is stored, never the full address. Record switches logging off (existing entries stay until you clear them) and Clear empties the list. The log is never exported or backed up.

Backup and restore

Export saves every rule and setting to download-router-settings-<date>-<time>.json.
Import shows what a file holds (how many rules, how many replace files, how many overlap with yours) before writing anything; a rule that replaces files from any site is the one to look out for in a file from someone else. Then choose Merge (a rule with the same domain and file types replaces yours in place; the rest are added), Replace all, or Cancel. Import also takes exports from earlier versions, a bare {"rules": ...} object, or a hand-written {"domain": "Folder"} map. Entries with no folder, or with neither a domain nor a file type, are skipped and counted in the summary.

Scheduled backup. Turn on Back up rules automatically and the same file is saved every N days (1 to 365) to Download Router Backups/download-router-backup-<date>-<time>.json, or another folder inside Downloads. The extension checks hourly, so a backup missed while the browser was closed is made within an hour of opening it. Turning the schedule on backs up at once, and Back up now does too. Only the newest backup from each earlier day is kept, for as many days as the Keep setting allows; days with no backup don’t count, and cleanup runs only after a new backup has saved. Cleanup only deletes files the extension saved that are still in the browser’s download history. Nothing is backed up while there are no rules, so an empty setup never pushes out a good backup.

Restore puts back everything a backup or export file holds: the whole rule set, the backup schedule and the Record switch. It shows when the file was saved and what would change, including rules that replace files and a moved backup folder, before you confirm. Settings the file doesn’t have are left as they are, and the activity log isn’t touched. A restored file is checked the same way as the rule form, so a crafted file can’t store anything the form wouldn’t.

Rules live in chrome.storage.local, per profile and never synced, so Export is how you move a setup to another machine or browser. Rules stored by 2.x versions (an object keyed by domain) are converted to the current list the first time they’re read, and old export files still import.

Things to know

  • The file picker can close the popup. If an import is cut off, run it from the full page.
  • Replacing is permanent. There’s no undo and nothing goes to the trash.
  • The extension’s own files are never routed. Exports and scheduled backups skip the rules and the log. The check uses where the download came from, so a site that puts the extension’s address in its own URL is still routed.
  • Other plugins’ backups keep their own path. Chrome drops the file name an extension asks for once any extension renames downloads, so Download Router puts it back for the scheduled backups of the other plugins in this suite (SUITE_BACKUP_PREFIXES in rules.js), and only for those.
  • Backups show in the download list. Each is an ordinary download; old ones disappear when cleanup deletes them.
  • “Ask where to save each file” still applies. The save dialog opens with the routed path filled in.

Files

File Purpose
manifest.json Manifest V3, module service worker
background.js Service worker: routes each download as it starts, records it, honors the suite’s backup paths, runs scheduled backups
rules.js Rule shape, migration, matching, folder cleanup, log, export, import and restore. A plain script on self.DownloadRouter, loaded by the worker with import and by the pages with <script> (tested in Node)
ui.js, ui.css The interface, shared by both pages: rule editor, export and import, backup schedule, restore, activity log
popup.html, options.html Toolbar popup and full-page shells
shared/backup.js Shared backup helpers and scheduler, on globalThis.SharedBackup. Do not edit here
shared/sender.js Shared message-sender and host checks. Do not edit here
shared/suite.js Link to the Plugin Suite Backup Manager, on globalThis.SuiteLink. Do not edit here
shared/brand.js The “Made by infolific.com” footer on this plugin’s pages (logo, plugin page and hub links). Do not edit here
shared/infolific.png, shared/infolific-24.png The infolific.com logo, for the footer and (24px) the top of this README
test_rules.mjs Node tests: node test_rules.mjs
icons/ Toolbar and extensions-page icons, and icon.svg, their source (the PNGs add the infolific.com badge from tools/brand/badge-icons.py)
screenshot.png The screenshot above

Permissions

Permission Why
downloads Seeing each download and choosing its folder; saving scheduled backups and removing old ones
storage Rules, settings and the activity log
alarms Hourly check for whether a scheduled backup is due

No access to websites is requested: the downloads API already reports where each file comes from. The extension makes no network requests and sends nothing anywhere.

Security notes

  • Domain rules match the host the file comes from after redirects, never text elsewhere in the URL or the page that linked to it, so a look-alike site or an open redirect can’t plant a file in a routed folder.
  • Programs, scripts and files with no extension are never overwritten (mayReplace), and log entries for replaced files are kept longer (trimLog) so a burst of downloads can’t hide them.
  • Folder names are cleaned (sanitizeFolder) so no rule or backup folder can leave the download folder.
  • Other extensions’ path hints are honored only for the suite’s backup file names (isSuiteBackupPath).
  • The message handler checks the sender with shared/sender.js: only the popup and options page can ask for a backup.
  • Imported and restored files go through the same checks as the form, and Import and Restore point out rules that replace files before anything is written.
  • File names, sites and rule text are written with textContent. innerHTML is used only for the page’s fixed template and to empty lists.
  • The link to the Plugin Suite Backup Manager (shared/suite.js) answers only the manager’s fixed extension id. It can report the backup schedule and last backup, start a backup, and open the restore page with a backup file. It never writes settings itself, so a file it hands over goes through the same checks and confirmation as one picked on that page.

Tests

node test_rules.mjs

Version history

2.7.0 — infolific.com branding: a “Made by infolific.com” footer on the options and popup pages, linking to this plugin’s page and the infolific.com hub for AI-created software (shared/brand.js); a small infolific.com badge on the icons; and the manifest’s homepage_url points to the plugin’s page, so the extensions page shows a Website link.

2.6.0 — Works with the new Plugin Suite Backup Manager, which shows this plugin’s backup schedule and last backup, can start a backup, and can hand a backup file to the restore page here.
Only the manager’s extension id is answered (shared/suite.js).

2.5.9 — Knows Cache Clearer’s scheduled backups (cache-clearer-backup-), so they keep their folder.

2.5.8 — Follows the plugin template: the worker checks message senders with shared/sender.js, the manifest sets minimum_chrome_version, and the README uses the template’s sections, with a screenshot.

2.5.7 — The service worker is an ES module, loading its helpers with import instead of importScripts(). Alarms, settings and backups carry over.

2.5.6 — Scheduled backups run on the suite’s shared backup code (shared/backup.js). Backup files, and restoring old ones, are unchanged.

3.4 — Security: domain rules match where the file comes from after redirects, not the page that linked to it. Programs and scripts are never replaced. Import and Restore point out rules that replace files. Entries for replaced files stay in the log longer.

3.3 — Security: domain rules match the site’s host name, not text anywhere in the URL. Access to all websites removed. Only the suite’s backup file names are honored for other extensions. Backup requests are only taken from the extension’s own pages.

3.2 — Restore: bring back every setting from a backup file, separate from Import.

3.1 — Scheduled backup every N days into a chosen folder, keeping a set number of earlier backups, counted one per day.

3.0 — File-type matching, per-rule on/off, activity log, full-page view. Rules are stored as an ordered list; older storage is converted on read.

2.7 — Icons moved into an icons folder.

2.6 — Custom icon at all four sizes, shown in the popup header.

2.5 — Export and Import moved to a sticky top bar; paste-JSON option removed.

2.4 — Export file name time as six digits (143052).

2.3 — Time added to the export file name.

2.2 — Export and import of all settings.

2.1 — Per-rule option to replace same-name files.

2.0 — Rule editing.

⬇️ Download Download Router.zip275.3 KBLast Updated: November 27, 2026Vivaldi

← All AI-created software