1.0.0 • Published 5 years ago
flatten-chrome-bookmark-child v1.0.0
This simple function is used to transform the google chrome tree bookmarks into an array to make it easier to work with.
For instance, this function can be used to process the Google Chrome function chrome.bookmarks.get
(see https://developer.chrome.com/extensions/bookmarks#method-get).
This can also process directly the file stored by Google Chrome.
On my linux machine, this file is located here:
~/.config/google-chrome/Default/Bookmarks
Here is an example on how to use this function on that file:
const { readFile } = require('fs');
// change this variable with your actual path to the file
const filepath = '/home/<myhome>/.config/google-chrome/Default/Bookmarks';
const bookmarks = readFile(filepath, 'utf-8', function(err, bookmarksString) {
const bookmarksList = getChromeBookmarks(JSON.parse(bookmarksString));
// do whatever you want with it
console.log('bookmarksList', bookmarksList);
});
1.0.0
5 years ago