<!DOCTYPE html>

<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width">
    <title>Userscript Utils Module: userscript-utils/getUpdateMetablock</title>

    <!--[if lt IE 9]>
    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">

    <link type="text/css" rel="stylesheet" href="styles/site.simplex.css">

</head>

<body>

<div class="navbar navbar-default navbar-fixed-top navbar-inverse">
    <div class="container">
        <div class="navbar-header">
            <a class="navbar-brand" href="index.html">Userscript Utils</a>
            <button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#topNavigation">
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
        </div>
        <div class="navbar-collapse collapse" id="topNavigation">
            <ul class="nav navbar-nav">

                <li class="dropdown">
                    <a href="modules.list.html" class="dropdown-toggle" data-toggle="dropdown">Modules<b
                            class="caret"></b></a>
                    <ul class="dropdown-menu ">
                        <li><a href="module-userscript-utils.html">userscript-utils</a></li>
                        <li><a href="module-userscript-utils_getMetablock.html">userscript-utils/getMetablock</a></li>
                        <li><a href="module-userscript-utils_getUpdateMetablock.html">userscript-utils/getUpdateMetablock</a>
                        </li>
                    </ul>
                </li>

                <li class="dropdown">
                    <a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b class="caret"></b></a>
                    <ul class="dropdown-menu ">
                        <li><a href="global.html">Global</a></li>
                    </ul>
                </li>

            </ul>
            <div class="col-sm-3 col-md-3">
                <form class="navbar-form" role="search">
                    <div class="input-group">
                        <input type="text" class="form-control" placeholder="Search" name="q" id="search-input">
                        <div class="input-group-btn">
                            <button class="btn btn-default" id="search-submit"><i
                                    class="glyphicon glyphicon-search"></i></button>
                    </div>
                    </div>
                </form>
        </div>
        </div>

</div>
</div>


<div class="container" id="toc-content">
    <div class="row">


        <div class="col-md-8">

            <div id="main">


                <h1 class="page-title">Module: userscript-utils/getUpdateMetablock</h1>
                <section>

                    <header>

                    </header>


                    <article>
                        <div class="container-overview">


                            <div class="description"><p>Extract the part of the metablock that's needed for @updateURL
                                requests</p></div>


                            <dl class="details">


                                <dt class="tag-author method-doc-label method-doc-details-label">Author:</dt>
                                <dd class="tag-author">
                                    <ul>
                                        <li><a href="mailto:a.molcanovas@gmail.com">Art</a></li>
                                    </ul>
                                </dd>


                                <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
                                <dd class="tag-source">
                                    <ul class="dummy">
                                        <li>
                                            <a href="lib_get-update-metablock.js.html">lib/get-update-metablock.js</a>,
                                            <a href="lib_get-update-metablock.js.html#sunlight-1-line-22">line 22</a>
                                        </li>
                                    </ul>
                                </dd>


                            </dl>


                        </div>


                        <h3 class="subsection-title">Methods</h3>

                        <dl>

                            <hr>
                            <dt>
                            <h4 class="name" id=".fromFile"><span class="type-signature">&lt;static> </span>fromFile(file,
                                callback [, incUpdateURL] [, incDownloadURL])</h4>


                            </dt>
                            <dd>


                                <div class="description">
                                    <p>Asynchronously extract the update metablock from the given file</p>
                                </div>


                                <h5>Parameters:</h5>


                                <table class="params table table-striped">
                                    <thead>
                                    <tr>

                                        <th>Name</th>


                                        <th>Type</th>


                                        <th>Argument</th>


                                        <th>Default</th>


                                        <th class="last">Description</th>
                                    </tr>
                                    </thead>

                                    <tbody>


                                    <tr>

                                        <td class="name"><code>file</code></td>


                                        <td class="type">


                                            <span class="param-type">string</span>


                                        </td>


                                        <td class="attributes">


                                        </td>


                                        <td class="default">

                                        </td>


                                        <td class="description last"><p>Path to the file</p></td>
                                    </tr>


                                    <tr>

                                        <td class="name"><code>callback</code></td>


                                        <td class="type">


                                            <span class="param-type"><a
                                                    href="global.html#UserscriptUtilsErrStringCallback">UserscriptUtilsErrStringCallback</a></span>


                                        </td>


                                        <td class="attributes">


                                        </td>


                                        <td class="default">

                                        </td>


                                        <td class="description last"><p>The callback function</p></td>
                                    </tr>


                                    <tr>

                                        <td class="name"><code>incUpdateURL</code></td>


                                        <td class="type">


                                            <span class="param-type">boolean</span>


                                        </td>


                                        <td class="attributes">

                                            &lt;optional><br>


                                        </td>


                                        <td class="default">

                                            false

                                        </td>


                                        <td class="description last"><p>Whether to include the @updateURL tag</p></td>
                                    </tr>


                                    <tr>

                                        <td class="name"><code>incDownloadURL</code></td>


                                        <td class="type">


                                            <span class="param-type">boolean</span>


                                        </td>


                                        <td class="attributes">

                                            &lt;optional><br>


                                        </td>


                                        <td class="default">

                                            false

                                        </td>


                                        <td class="description last"><p>Whether to include the @downloadURL tag</p></td>
                                    </tr>


                                    </tbody>
                                </table>


                                <dl class="details">


                                    <dt class="tag-author method-doc-label method-doc-details-label">Author:</dt>
                                    <dd class="tag-author">
                                        <ul>
                                            <li><a href="mailto:a.molcanovas@gmail.com">Art</a></li>
                                        </ul>
                                    </dd>


                                    <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
                                    <dd class="tag-source">
                                        <ul class="dummy">
                                            <li>
                                                <a href="lib_get-update-metablock.js.html">lib/get-update-metablock.js</a>,
                                                <a href="lib_get-update-metablock.js.html#sunlight-1-line-98">line
                                                    98</a>
                                            </li>
                                        </ul>
                                    </dd>


                                </dl>


                            </dd>


                            <hr>
                            <dt>
                            <h4 class="name" id=".fromFileSync"><span class="type-signature">&lt;static> </span>fromFileSync(file
                                [, incUpdateURL] [, incDownloadURL])</h4>


                            </dt>
                            <dd>


                                <div class="description">
                                    <p>Synchronously extract the update metablock from the given file</p>
                                </div>


                                <h5>Parameters:</h5>


                                <table class="params table table-striped">
                                    <thead>
                                    <tr>

                                        <th>Name</th>


                                        <th>Type</th>


                                        <th>Argument</th>


                                        <th>Default</th>


                                        <th class="last">Description</th>
                                    </tr>
                                    </thead>

                                    <tbody>


                                    <tr>

                                        <td class="name"><code>file</code></td>


                                        <td class="type">


                                            <span class="param-type">string</span>


                                        </td>


                                        <td class="attributes">


                                        </td>


                                        <td class="default">

                                        </td>


                                        <td class="description last"><p>Path to the file</p></td>
                                    </tr>


                                    <tr>

                                        <td class="name"><code>incUpdateURL</code></td>


                                        <td class="type">


                                            <span class="param-type">boolean</span>


                                        </td>


                                        <td class="attributes">

                                            &lt;optional><br>


                                        </td>


                                        <td class="default">

                                            false

                                        </td>


                                        <td class="description last"><p>Whether to include the @updateURL tag</p></td>
                                    </tr>


                                    <tr>

                                        <td class="name"><code>incDownloadURL</code></td>


                                        <td class="type">


                                            <span class="param-type">boolean</span>


                                        </td>


                                        <td class="attributes">

                                            &lt;optional><br>


                                        </td>


                                        <td class="default">

                                            false

                                        </td>


                                        <td class="description last"><p>Whether to include the @downloadURL tag</p></td>
                                    </tr>


                                    </tbody>
                                </table>


                                <dl class="details">


                                    <dt class="tag-author method-doc-label method-doc-details-label">Author:</dt>
                                    <dd class="tag-author">
                                        <ul>
                                            <li><a href="mailto:a.molcanovas@gmail.com">Art</a></li>
                                        </ul>
                                    </dd>


                                    <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
                                    <dd class="tag-source">
                                        <ul class="dummy">
                                            <li>
                                                <a href="lib_get-update-metablock.js.html">lib/get-update-metablock.js</a>,
                                                <a href="lib_get-update-metablock.js.html#sunlight-1-line-87">line
                                                    87</a>
                                            </li>
                                        </ul>
                                    </dd>


                                </dl>


                                <h5>Throws:</h5>


                                <dl>
                                    <dt>
                                    <div class="param-desc">
                                        <p>if the metadata block is not found</p>
                                    </div>
                                    </dt>
                                    <dt>
                                    <dl>
                                        <dt>
                                            Type
                                        </dt>
                                        <dd>

                                            <span class="param-type">Error</span>


                                        </dd>
                                    </dl>
                                    </dt>
                                </dl>


                                <h5>Returns:</h5>


                                <div class="param-desc">
                                    <p>The reduced metadata block suitable for .meta.js files</p>
                                </div>


                                <dl>
                                    <dt>
                                        Type
                                    </dt>
                                    <dd>

                                        <span class="param-type">string</span>


                                    </dd>
                                </dl>


                            </dd>


                            <hr>
                            <dt>
                            <h4 class="name" id=".fromString"><span class="type-signature">&lt;static> </span>fromString(str,
                                callback [, incUpdateURL] [, incDownloadURL])</h4>


                            </dt>
                            <dd>


                                <div class="description">
                                    <p>Asynchronously extract the update metablock from the given string</p>
                                </div>


                                <h5>Parameters:</h5>


                                <table class="params table table-striped">
                                    <thead>
                                    <tr>

                                        <th>Name</th>


                                        <th>Type</th>


                                        <th>Argument</th>


                                        <th>Default</th>


                                        <th class="last">Description</th>
                                    </tr>
                                    </thead>

                                    <tbody>


                                    <tr>

                                        <td class="name"><code>str</code></td>


                                        <td class="type">


                                            <span class="param-type">string</span>


                                        </td>


                                        <td class="attributes">


                                        </td>


                                        <td class="default">

                                        </td>


                                        <td class="description last"><p>The string to extract from</p></td>
                                    </tr>


                                    <tr>

                                        <td class="name"><code>callback</code></td>


                                        <td class="type">


                                            <span class="param-type"><a
                                                    href="global.html#UserscriptUtilsErrStringCallback">UserscriptUtilsErrStringCallback</a></span>


                                        </td>


                                        <td class="attributes">


                                        </td>


                                        <td class="default">

                                        </td>


                                        <td class="description last"><p>The callback function</p></td>
                                    </tr>


                                    <tr>

                                        <td class="name"><code>incUpdateURL</code></td>


                                        <td class="type">


                                            <span class="param-type">boolean</span>


                                        </td>


                                        <td class="attributes">

                                            &lt;optional><br>


                                        </td>


                                        <td class="default">

                                            false

                                        </td>


                                        <td class="description last"><p>Whether to include the @updateURL tag</p></td>
                                    </tr>


                                    <tr>

                                        <td class="name"><code>incDownloadURL</code></td>


                                        <td class="type">


                                            <span class="param-type">boolean</span>


                                        </td>


                                        <td class="attributes">

                                            &lt;optional><br>


                                        </td>


                                        <td class="default">

                                            false

                                        </td>


                                        <td class="description last"><p>Whether to include the @downloadURL tag</p></td>
                                    </tr>


                                    </tbody>
                                </table>


                                <dl class="details">


                                    <dt class="tag-author method-doc-label method-doc-details-label">Author:</dt>
                                    <dd class="tag-author">
                                        <ul>
                                            <li><a href="mailto:a.molcanovas@gmail.com">Art</a></li>
                                        </ul>
                                    </dd>


                                    <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
                                    <dd class="tag-source">
                                        <ul class="dummy">
                                            <li>
                                                <a href="lib_get-update-metablock.js.html">lib/get-update-metablock.js</a>,
                                                <a href="lib_get-update-metablock.js.html#sunlight-1-line-69">line
                                                    69</a>
                                            </li>
                                        </ul>
                                    </dd>


                                </dl>


                            </dd>


                            <hr>
                            <dt>
                            <h4 class="name" id=".fromStringSync"><span class="type-signature">&lt;static> </span>fromStringSync(str
                                [, incUpdateURL] [, incDownloadURL])</h4>


                            </dt>
                            <dd>


                                <div class="description">
                                    <p>Synchronously extract the update metablock from the given string</p>
                                </div>


                                <h5>Parameters:</h5>


                                <table class="params table table-striped">
                                    <thead>
                                    <tr>

                                        <th>Name</th>


                                        <th>Type</th>


                                        <th>Argument</th>


                                        <th>Default</th>


                                        <th class="last">Description</th>
                                    </tr>
                                    </thead>

                                    <tbody>


                                    <tr>

                                        <td class="name"><code>str</code></td>


                                        <td class="type">


                                            <span class="param-type">string</span>


                                        </td>


                                        <td class="attributes">


                                        </td>


                                        <td class="default">

                                        </td>


                                        <td class="description last"><p>The string to extract from</p></td>
                                    </tr>


                                    <tr>

                                        <td class="name"><code>incUpdateURL</code></td>


                                        <td class="type">


                                            <span class="param-type">boolean</span>


                                        </td>


                                        <td class="attributes">

                                            &lt;optional><br>


                                        </td>


                                        <td class="default">

                                            false

                                        </td>


                                        <td class="description last"><p>Whether to include the @updateURL tag</p></td>
                                    </tr>


                                    <tr>

                                        <td class="name"><code>incDownloadURL</code></td>


                                        <td class="type">


                                            <span class="param-type">boolean</span>


                                        </td>


                                        <td class="attributes">

                                            &lt;optional><br>


                                        </td>


                                        <td class="default">

                                            false

                                        </td>


                                        <td class="description last"><p>Whether to include the @downloadURL tag</p></td>
                                    </tr>


                                    </tbody>
                                </table>


                                <dl class="details">


                                    <dt class="tag-author method-doc-label method-doc-details-label">Author:</dt>
                                    <dd class="tag-author">
                                        <ul>
                                            <li><a href="mailto:a.molcanovas@gmail.com">Art</a></li>
                                        </ul>
                                    </dd>


                                    <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
                                    <dd class="tag-source">
                                        <ul class="dummy">
                                            <li>
                                                <a href="lib_get-update-metablock.js.html">lib/get-update-metablock.js</a>,
                                                <a href="lib_get-update-metablock.js.html#sunlight-1-line-32">line
                                                    32</a>
                                            </li>
                                        </ul>
                                    </dd>


                                </dl>


                                <h5>Throws:</h5>


                                <dl>
                                    <dt>
                                    <div class="param-desc">
                                        <p>if the metadata block is not found</p>
                                    </div>
                                    </dt>
                                    <dt>
                                    <dl>
                                        <dt>
                                            Type
                                        </dt>
                                        <dd>

                                            <span class="param-type">Error</span>


                                        </dd>
                                    </dl>
                                    </dt>
                                </dl>


                                <h5>Returns:</h5>


                                <div class="param-desc">
                                    <p>The reduced metadata block suitable for .meta.js files</p>
                                </div>


                                <dl>
                                    <dt>
                                        Type
                                    </dt>
                                    <dd>

                                        <span class="param-type">string</span>


                                    </dd>
                                </dl>


                            </dd>

                        </dl>


                    </article>

                </section>


            </div>
        </div>

        <div class="clearfix"></div>


        <div class="col-md-3">
            <div id="toc" class="col-md-3 hidden-xs hidden-sm hidden-md"></div>
        </div>


    </div>
</div>

<div class="modal fade" id="searchResults">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                        aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">Search results</h4>
            </div>
            <div class="modal-body"></div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div>

<footer>


	<span class="copyright">
	Created and maintained by <a href="https://github.com/Alorel">Alorel</a>. Source available <a
            href="https://github.com/Alorel/userscript-utils">here</a>.
	</span>

<span class="jsdoc-message">
	Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a>
	
		on Thursday, 16th June, 2016
	
	using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
</footer>

<script src="scripts/docstrap.lib.js"></script>
<script src="scripts/toc.js"></script>
<script type="text/javascript" src="scripts/fulltext-search-ui.js"></script>

<script>
    $(function () {
        $("[id*='$']").each(function () {
            var $this = $(this);

            $this.attr("id", $this.attr("id").replace("$", "__"));
        });

        $(".tutorial-section pre, .readme-section pre").each(function () {
            var $this = $(this);

            var example = $this.find("code");
            exampleText = example.html();
            var lang = /{@lang (.*?)}/.exec(exampleText);
            if (lang && lang[1]) {
                exampleText = exampleText.replace(lang[0], "");
                example.html(exampleText);
                lang = lang[1];
            } else {
                var langClassMatch = example.parent()[0].className.match(/lang\-(\S+)/);
                lang = langClassMatch ? langClassMatch[1] : "javascript";
            }

            if (lang) {

                $this
                        .addClass("sunlight-highlight-" + lang)
                        .addClass("linenums")
                        .html(example.html());

            }
        });

        Sunlight.highlightAll({
            lineNumbers: true,
            showMenu: true,
            enableDoclinks: true
        });

        $.catchAnchorLinks({
            navbarOffset: 10
        });
        $("#toc").toc({
            anchorName: function (i, heading, prefix) {
                var id = $(heading).attr("id");
                return id && id.replace(/\~/g, '-inner-').replace(/\./g, '-static-') || ( prefix + i );
            },
            selectors: "#toc-content h1,#toc-content h2,#toc-content h3,#toc-content h4",
            showAndHide: false,
            smoothScrolling: true
        });

        $("#main span[id^='toc']").addClass("toc-shim");
        $('.dropdown-toggle').dropdown();

        $("table").each(function () {
            var $this = $(this);
            $this.addClass('table');
        });

    });
</script>



<!--Navigation and Symbol Display-->


<!--Google Analytics-->

<script>
    (function (i, s, o, g, r, a, m) {
        i['GoogleAnalyticsObject'] = r;
        i[r] = i[r] || function () {
                    (i[r].q = i[r].q || []).push(arguments)
                }, i[r].l = 1 * new Date();
        a = s.createElement(o),
                m = s.getElementsByTagName(o)[0];
        a.async = 1;
        a.src = g;
        m.parentNode.insertBefore(a, m)
    })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');

    ga('create', 'UA-76993341-1', 'auto');
    ga('send', 'pageview');
</script>


<script type="text/javascript">
    $(document).ready(function () {
        SearcherDisplay.init();
    });
</script>

</body>
</html>