Extract the entire metadata block
- 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
- Source:
-
<static> fromFileSync(file)
-
Synchronously extracts the metablock from the given file
Parameters:
Name Type Description file
string Path to the file
- 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
- Source:
-
<static> fromStringSync(contents)
-
Synchronously extracts the metablock from the given string
Parameters:
Name Type Description contents
string The string to extract from
- Source:
Throws:
-
If the metadata block is not found
- Type
- Error
Returns:
The extracted metadata block
- Type
- string