Revision 508969 of net/url

  • Revision slug: Mozilla/Add-ons/SDK/Low-Level_APIs/net_url
  • Revision title: net/url
  • Revision id: 508969
  • Created:
  • Creator: wbamberg
  • Is current revision? No
  • Comment

Revision Content

Experimental

Enables you to read content from a URI.

Globals

Functions

readURI(uri, options)

Reads a URI and returns a promise.

Parameters

uri : string
The URL, as a string, to load.

options : object
Optional options:

Name Type  
sync boolean

If this option is set to true, the promise returned will be resolved synchronously. Defaults to false if not provided.

charset string

The character set to use when read the content of the uri given. Defaults to UTF-8 if not provided.

Returns

promise : The promise that will be resolved with the content of the URL given.

Revision Source

<div class="note">
 <p>Experimental</p>
</div>
<p>Enables you to read content from a URI.</p>
<h2>Globals</h2>
<h3>Functions</h3>
<h4 class="addon-sdk-api-name"><code>readURI(uri, options)</code></h4>
<p>Reads a URI and returns a <a href="modules/sdk/core/promise.html">promise</a>.</p>
<h5>Parameters</h5>
<p><strong>uri : string</strong><br />
 The URL, as a string, to load.</p>
<p><strong>options : object</strong><br />
 Optional options:</p>
<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Name</th>
   <th scope="col">Type</th>
   <th scope="col">&nbsp;</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>sync</td>
   <td>boolean</td>
   <td>
    <p>If this option is set to <code>true</code>, the promise returned will be resolved synchronously. Defaults to <code>false</code> if not provided.</p>
   </td>
  </tr>
  <tr>
   <td>charset</td>
   <td>string</td>
   <td>
    <p>The character set to use when read the content of the <code>uri</code> given. Defaults to <code>UTF-8</code> if not provided.</p>
   </td>
  </tr>
 </tbody>
</table>
<h5>Returns</h5>
<p><strong>promise</strong> : The promise that will be resolved with the content of the URL given.</p>
Revert to this revision