This file is indexed.

/usr/share/doc/cockpit/guide/cockpit-util.html is in cockpit-doc 164-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>cockpit.js: Utilities</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="Cockpit Guide">
<link rel="up" href="api-base1.html" title="API: base1">
<link rel="prev" href="cockpit-login.html" title="cockpit.js: User Session">
<link rel="next" href="cockpit-cache.html" title="cockpit.js: Object Cache">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
<td><a accesskey="p" href="cockpit-login.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="api-base1.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">Cockpit Guide</th>
<td><a accesskey="n" href="cockpit-cache.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="cockpit-util"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>cockpit.js: Utilities</h2>
<p>cockpit.js: Utilities — Various utility functions</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsection">
<a name="cockpit-format"></a><h2>cockpit.format()</h2>
<pre class="programlisting">
string = cockpit.format(template, args)
string = cockpit.format(template, [arg, ...])
</pre>
<p>Format a string interpolating <code class="code">args</code> into <code class="code">template</code> using
      shell like syntax. The <code class="code">args</code> may be either an array or javascript object.
      The <code class="code">template</code> can contain fields that look like <code class="code">$name</code> or
      <code class="code">${name}</code> or <code class="code">$0</code>. Numeric fields are used with array
      <code class="code">args</code> and start at zero.</p>
<p>In the second form, multiple <code class="code">arg</code> arguments may be passed directly,
      and interpolated as as numeric fields in the <code class="code">template</code>.</p>
</div>
<div class="refsection">
<a name="cockpit-format-bytes"></a><h2>cockpit.format_bytes()</h2>
<pre class="programlisting">
string = cockpit.format_bytes(number, [factor])
array = cockpit.format_bytes(number, [factor, separate])
</pre>
<p>Formats <code class="code">number</code> into a displayable <code class="code">string</code> with a suffix, such as
      <span class="emphasis"><em>KB</em></span> or <span class="emphasis"><em>MB</em></span>. Returns an <code class="code">array</code> of the
      formatted number and the suffix if <code class="code">separate</code> is set to <code class="code">true</code>.</p>
<p>If specifying 1000 or 1024 is specified as a <code class="code">factor</code> then an appropriate suffix
      will be chosen. By default the <code class="code">factor</code> is 1024.  You can pass a string suffix as a
      <code class="code">factor</code> in which case the resulting number will be formatted with the same suffix.</p>
<p>If the <code class="code">number</code> is less than the <code class="code">factor</code> or an unknown factor
      was passed in, then the formatted number is returned without a suffix. If <code class="code">separate</code>
      is true, returns an array of <code class="code">[formatted_number, suffix]</code> or
      <code class="code">[formatted_number]</code> if returned without a suffix.</p>
<p>If <code class="code">number</code> is <code class="code">null</code> or <code class="code">undefined</code> an empty string or
      an array without a suffix will be returned.</p>
</div>
<div class="refsection">
<a name="cockpit-format-number"></a><h2>cockpit.format_number()</h2>
<pre class="programlisting">
string = cockpit.format_number(number)
</pre>
<p>Formats <code class="code">number</code> into a displayable <code class="code">string</code>. If the number is not
      an integer, it is rounded to a single decimal place precision. If the number is near zero, but
      not quite zero it is rounded up or down to a single decimal place.</p>
<p>If <code class="code">number</code> is <code class="code">null</code> or <code class="code">undefined</code> an empty string
      will be returned.</p>
</div>
<div class="refsection">
<a name="cockpit-format-bytes-per-sec"></a><h2>cockpit.format_bytes_per_sec()</h2>
<pre class="programlisting">
 string = cockpit.format_bytes_per_sec(number, [factor])
 array = cockpit.format_bytes_per_sec(number, [factor, separate])
</pre>
<p>Format <code class="code">number</code> of bytes into a displayable speed <code class="code">string</code>.</p>
<p>If specifying 1000 or 1024 is specified as a <code class="code">factor</code> then an appropriate suffix
      will be chosen. By default the <code class="code">factor</code> is 1024.  You can pass a string suffix as a
      <code class="code">factor</code> in which case the resulting number will be formatted with the same suffix.</p>
<p>If the <code class="code">number</code> is less than the <code class="code">factor</code> or an unknown factor
      was passed in, then the formatted number is returned without a suffix. If <code class="code">separate</code>
      is true, returns an array of <code class="code">[formatted_number, suffix]</code> or
      <code class="code">[formatted_number]</code> if returned without a suffix.</p>
<p>If <code class="code">number</code> is <code class="code">null</code> or <code class="code">undefined</code> an empty string or array
      will be returned.</p>
</div>
<div class="refsection">
<a name="cockpit-format-bits-per-sec"></a><h2>cockpit.format_bits_per_sec()</h2>
<pre class="programlisting">
  string = cockpit.format_bits_per_sec(number, [factor])
 array = cockpit.format_bytes_per_sec(number, [factor, separate])
</pre>
<p>Format <code class="code">number</code> of bits into a displayable speed <code class="code">string</code>.</p>
<p>If specifying 1000 or 1024 is specified as a <code class="code">factor</code> then an appropriate suffix
      will be chosen. By default the <code class="code">factor</code> is 1024.  You can pass a string suffix as a
      <code class="code">factor</code> in which case the resulting number will be formatted with the same suffix.</p>
<p>If the <code class="code">number</code> is less than the <code class="code">factor</code> or an unknown factor
      was passed in, then the formatted number is returned without a suffix. If <code class="code">separate</code>
      is true, returns an array of <code class="code">[formatted_number, suffix]</code> or
      <code class="code">[formatted_number]</code> if returned without a suffix.</p>
<p>If <code class="code">number</code> is <code class="code">null</code> or <code class="code">undefined</code> an empty string or array
      will be returned.</p>
</div>
<div class="refsection">
<a name="cockpit-info"></a><h2>cockpit.info</h2>
<pre class="programlisting">
cockpit.info["version"]
cockpit.info["build"]
</pre>
<p>This object contains information about cockpit itself. Note that when cockpit is
      running on multiple servers, this only reflects the server that was connected to.
      The following fields are defined:</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><code class="code">"build"</code></span></p></td>
<td><p>A string containing build details.</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="code">"version"</code></span></p></td>
<td><p>A string containing the cockpit version number. It is almost always
          incorrect to use this to make a decision in code.</p></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsection">
<a name="cockpit-event-target"></a><h2>cockpit.event_target</h2>
<pre class="programlisting">
cockpit.event_target(object, [handlers])
</pre>
<p>Adds an
      <a class="ulink" href="https://developer.mozilla.org/en-US/docs/Web/API/EventTarget" target="_top">EventTarget</a>
      implementation to the <code class="code">object</code>. Optionally store the handlers in <code class="code">handlers</code>
      if its specified.</p>
</div>
<div class="refsection">
<a name="cockpit-extend"></a><h2>cockpit.extend</h2>
<pre class="programlisting">
cockpit.extend(target, src, ...)
</pre>
<p>This function is used to copy the values of all enumerable own properties
      from one or more source objects to a target object. It will return the target object. This
      is similar to <code class="code">Object.assign()</code>.</p>
</div>
</div>
<div class="footer"><hr></div>
</body>
</html>