Class

Profile

Profile(options)

Allow to manipulate a browser session

Constructor

new Profile(options)

Create a Profile

Parameters:
Name Type Description
options module:profile/profile~ProfileOptions

View Source profile/profile.js, line 34

Methods

static assertValidBrowser(browser)

throw an exception if {browser} is not valid

Parameters:
Name Type Description
browser string

View Source profile/profile.js, line 209

async static exists(path) → {Promise.<boolean>}

Path of the profile on the file system

Parameters:
Name Type Description
path string

path of the profile

View Source profile/profile.js, line 193

true is profile exists

Promise.<boolean>

async static getChromeExtension() → {Promise.<String>}

Get extension for chrome from url and save it to {cache}

Parameters:
Name Type Description
params.id string

the id of the chrome extension you can also use the {url} param (see examples)

params.url string

the url of the chrome extension (see examples)

params.name string

the name of the extension. Will be used as foldername of the extension, so avoid special characters, especially "/" !

params.cache string

path of the cache folder where the extension will be stored (created if don't exist)

params.verbose boolean

should the function display debug info ? (download progress bar, etc...)

View Source profile/profile.js, line 267

  • Return a promise of the path of the extension
Promise.<String>
Example
let extensionPath = await Profile.getChromeExtension({
	// This is the url of the extension on google Webstore
	url: "https://chrome.google.com/webstore/detail/ublock/epcnnfbjfcgphgdmggkamkmgojdagdnn?hl=en",
	name: "ublock",
	cache: "./.cache", //default value
	verbose: true
});
// You can make it shorter by extracting the extension id from the url:
let extensionPath = await Chrome.getExtension({
	// https://..../detail/ublock/{id}?hl=en
	id: "epcnnfbjfcgphgdmggkamkmgojdagdnn",
	name: "ublock",
	verbose: true
});
// You can also put the name before the id like this:
let extensionPath = await Chrome.getExtension({
	id: "ublock/epcnnfbjfcgphgdmggkamkmgojdagdnn",
	verbose: true
});

static path(browser, name) → {string}

Path of the profile on the file system

Parameters:
Name Type Description
browser 'firefox' | 'chromium'

the browser type:

name *

name of the profile

View Source profile/profile.js, line 180

the path of the profile

string

async static profile(options) → {Promise.<module:profile/profile~Profile>}

Load a profile or create it if it doesn't exist

Parameters:
Name Type Description
options module:profile/profile~ProfileOptions

View Source profile/profile.js, line 222

Promise.<module:profile/profile~Profile>

static validBrowser(browser)

Return true if {browser} is a valid browser name

Parameters:
Name Type Description
browser string

The type/name of the browser

View Source profile/profile.js, line 201

async assertDoesntExists()

Throw an error if the profile exists

View Source profile/profile.js, line 169

async assertExists()

Throw an error if the profile doesnt exist

View Source profile/profile.js, line 161

async clear()

Clear the profile : delete it if exist, then init it

View Source profile/profile.js, line 153

async copy(newName)

copy the profile

Parameters:
Name Type Description
newName string

View Source profile/profile.js, line 124

async exists() → {Promise.<boolean>}

Return true if profile exists in file system

View Source profile/profile.js, line 77

Promise.<boolean>

async init()

Init the profile - ie create a folder for the profile

View Source profile/profile.js, line 84

async remove()

Remove the profile

View Source profile/profile.js, line 146

async rename(newName)

Rename the profile

Parameters:
Name Type Description
newName string

View Source profile/profile.js, line 97