Module: userscript-utils/getUpdateMetablock

Extract the part of the metablock that's needed for @updateURL requests

Author:
Source:

Methods


<static> fromFile(file, callback [, incUpdateURL] [, incDownloadURL])

Asynchronously extract the update metablock from the given file

Parameters:
Name Type Argument Default Description
file string

Path to the file

callback UserscriptUtilsErrStringCallback

The callback function

incUpdateURL boolean <optional>
false

Whether to include the @updateURL tag

incDownloadURL boolean <optional>
false

Whether to include the @downloadURL tag

Author:
Source:

<static> fromFileSync(file [, incUpdateURL] [, incDownloadURL])

Synchronously extract the update metablock from the given file

Parameters:
Name Type Argument Default Description
file string

Path to the file

incUpdateURL boolean <optional>
false

Whether to include the @updateURL tag

incDownloadURL boolean <optional>
false

Whether to include the @downloadURL tag

Author:
Source:
Throws:

if the metadata block is not found

Type
Error
Returns:

The reduced metadata block suitable for .meta.js files

Type
string

<static> fromString(str, callback [, incUpdateURL] [, incDownloadURL])

Asynchronously extract the update metablock from the given string

Parameters:
Name Type Argument Default Description
str string

The string to extract from

callback UserscriptUtilsErrStringCallback

The callback function

incUpdateURL boolean <optional>
false

Whether to include the @updateURL tag

incDownloadURL boolean <optional>
false

Whether to include the @downloadURL tag

Author:
Source:

<static> fromStringSync(str [, incUpdateURL] [, incDownloadURL])

Synchronously extract the update metablock from the given string

Parameters:
Name Type Argument Default Description
str string

The string to extract from

incUpdateURL boolean <optional>
false

Whether to include the @updateURL tag

incDownloadURL boolean <optional>
false

Whether to include the @downloadURL tag

Author:
Source:
Throws:

if the metadata block is not found

Type
Error
Returns:

The reduced metadata block suitable for .meta.js files

Type
string