work to make documentation unified.

This commit is contained in:
Olivier Gagnon
2021-03-12 02:51:56 -05:00
parent a00c253dcb
commit 2ce6ff2041
176 changed files with 1325 additions and 916 deletions

View File

@@ -1,12 +1,12 @@
wget() Netscript Function
=========================
.. js:function:: wget(url, target[, hostname/ip=current ip])
.. js:function:: wget(url, target[, hostname=current hostname])
:RAM cost: 0 GB
:param string url: URL to pull data from
:param string target: Filename to write data to. Must be script or text file
:param string ip: Optional hostname/ip of server for target file.
:RAM cost: 0 GB
:param string ip: Optional hostname of server for target file.
Retrieves data from a URL and downloads it to a file on the specified server. The data can only
be downloaded to a script (.script, .ns, .js) or a text file (.txt). If the file already exists,
@@ -20,12 +20,12 @@ wget() Netscript Function
**IMPORTANT:** This is an asynchronous function that returns a Promise. The Promise's resolved
value will be a boolean indicating whether or not the data was successfully
retrieved from the URL. Because the function is async and returns a Promise,
it is recommended you use :code:`wget` in :ref:`netscriptjs`.
it is recommended you use ``wget`` in :ref:`netscriptjs`.
In NetscriptJS, you must preface any call to
:code:`wget` with the :code:`await` keyword (like you would :code:`hack` or :code:`sleep`).
``wget`` with the ``await`` keyword (like you would ``hack`` or ``sleep``).
:code:`wget` will still work in :ref:`netscript1`, but the functions execution will not
``wget`` will still work in :ref:`netscript1`, but the functions execution will not
be synchronous (i.e. it may not execute when you expect/want it to). Furthermore, since Promises are not
supported in ES5, you will not be able to process the returned value of :code:`wget` in
supported in ES5, you will not be able to process the returned value of ``wget`` in
Netscript 1.0.