Skip to content

Instantly share code, notes, and snippets.

@eralpkaraduman
Created February 6, 2018 15:48
Show Gist options
  • Save eralpkaraduman/fae5f11c1b0bb28dd7dd2f6562f43db7 to your computer and use it in GitHub Desktop.
Save eralpkaraduman/fae5f11c1b0bb28dd7dd2f6562f43db7 to your computer and use it in GitHub Desktop.
converting list of urls to netscape bookmarks html export format
var netscape = require('netscape-bookmarks');
var fs = require('fs');
var bookmarksList = fs.readFileSync('readinglistlinksfromsafari.txt').toString().split("\n");
var bookmarksObj = bookmarksList.reduce((acc, url) => {
var title = url;
acc[title] = url;
return acc;
}, {});
var html = netscape(bookmarksObj);
fs.writeFile("bookmarks.html", html, function(err) {
if(err) {
return console.log(err);
}
console.log("The file was saved!");
});
{
"name": "safariReadingListToBookmarkExport",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"netscape-bookmarks": "^0.1.0"
}
}
example1.com
example2.com
example3.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment