Module: userscript-utils/getMetablock

Extract the entire metadata block

Author:
Source:

Methods


<static> fromFile(file, callback)

Asynchronously extracts the metablock from the given file

Parameters:
Name Type Description
file string

Path to the file

callback UserscriptUtilsErrStringCallback

The callback function

Author:
Source:

<static> fromFileSync(file)

Synchronously extracts the metablock from the given file

Parameters:
Name Type Description
file string

Path to the file

Author:
Source:
Throws:

Error If the metadata block is not found or a FS error occurds (e.g. file not found)

Returns:

The extracted metadata block

Type
string

<static> fromString(contents, callback)

Asynchronously extracts the metablock from the given string

Parameters:
Name Type Description
contents string

The string to extract from

callback UserscriptUtilsErrStringCallback

The callback function

Author:
Source:

<static> fromStringSync(contents)

Synchronously extracts the metablock from the given string

Parameters:
Name Type Description
contents string

The string to extract from

Author:
Source:
Throws:

If the metadata block is not found

Type
Error
Returns:

The extracted metadata block

Type
string