Created
September 8, 2023 18:19
-
-
Save ThisIsMissEm/20ed76a36e8eb1e6f360a50cfb0d8411 to your computer and use it in GitHub Desktop.
This is a little script that I used to migrate my tabs from Chrome to Firefox, by using Tab Session Manager. Unfortunately though, the export file from Chrome failed silently to import to Firefox, so I needed to process the file: this produces output of the tab URLs and the title of each tab in a window, separated out by the windows that you had…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { readFile } from 'node:fs/promises' | |
async function main(args) { | |
const file = args[2]; | |
const contents = await readFile(args[2], { encoding: "utf8" }) | |
const session = JSON.parse(contents)[0]; | |
let count = 0; | |
for (const windowId in session.windows) { | |
const window = session.windows[windowId]; | |
process.stdout.write("\n\n --- \n\n"); | |
for (const tabId in window) { | |
const tab = window[tabId]; | |
process.stdout.write(`${tab.url} ${tab.title}\n`); | |
} | |
} | |
}; | |
main(process.argv).catch(console.error.bind(console)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"type": "module", | |
"name": "export-tsm-urls", | |
"private": true, | |
"version": "1.0.0", | |
"engines" : { | |
"node" : ">=18" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment