Update.
This commit is contained in:
+136
-18
@@ -42,39 +42,61 @@
|
||||
<li><a href="index.html">Overview</a></li>
|
||||
<li><a href="string.html">String</a></li>
|
||||
<li><a href="number.html">Num</a></li>
|
||||
<li><a href="http.html">http</a></li>
|
||||
<li><a href="websocket.html">websocket</a></li>
|
||||
<li><a href="tls.html">tls</a></li>
|
||||
<li><a href="net.html">net</a></li>
|
||||
<li><a href="dns.html">dns</a></li>
|
||||
<li><a href="json.html">json</a></li>
|
||||
<li><a href="argparse.html">argparse</a></li>
|
||||
<li><a href="base64.html">base64</a></li>
|
||||
<li><a href="regex.html">regex</a></li>
|
||||
<li><a href="jinja.html">jinja</a></li>
|
||||
<li><a href="crypto.html">crypto</a></li>
|
||||
<li><a href="os.html">os</a></li>
|
||||
<li><a href="env.html">env</a></li>
|
||||
<li><a href="signal.html">signal</a></li>
|
||||
<li><a href="subprocess.html">subprocess</a></li>
|
||||
<li><a href="sqlite.html">sqlite</a></li>
|
||||
<li><a href="dataset.html">dataset</a></li>
|
||||
<li><a href="datetime.html">datetime</a></li>
|
||||
<li><a href="timer.html">timer</a></li>
|
||||
<li><a href="dns.html">dns</a></li>
|
||||
<li><a href="env.html">env</a></li>
|
||||
<li><a href="fswatch.html">fswatch</a></li>
|
||||
<li><a href="html.html">html</a></li>
|
||||
<li><a href="http.html">http</a></li>
|
||||
<li><a href="io.html" class="active">io</a></li>
|
||||
<li><a href="pathlib.html">pathlib</a></li>
|
||||
<li><a href="scheduler.html">scheduler</a></li>
|
||||
<li><a href="jinja.html">jinja</a></li>
|
||||
<li><a href="json.html">json</a></li>
|
||||
<li><a href="markdown.html">markdown</a></li>
|
||||
<li><a href="math.html">math</a></li>
|
||||
<li><a href="net.html">net</a></li>
|
||||
<li><a href="os.html">os</a></li>
|
||||
<li><a href="pathlib.html">pathlib</a></li>
|
||||
<li><a href="regex.html">regex</a></li>
|
||||
<li><a href="scheduler.html">scheduler</a></li>
|
||||
<li><a href="signal.html">signal</a></li>
|
||||
<li><a href="sqlite.html">sqlite</a></li>
|
||||
<li><a href="subprocess.html">subprocess</a></li>
|
||||
<li><a href="sysinfo.html">sysinfo</a></li>
|
||||
<li><a href="tempfile.html">tempfile</a></li>
|
||||
<li><a href="timer.html">timer</a></li>
|
||||
<li><a href="tls.html">tls</a></li>
|
||||
<li><a href="udp.html">udp</a></li>
|
||||
<li><a href="uuid.html">uuid</a></li>
|
||||
<li><a href="wdantic.html">wdantic</a></li>
|
||||
<li><a href="web.html">web</a></li>
|
||||
<li><a href="websocket.html">websocket</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section">
|
||||
<span class="section-title">Tutorials</span>
|
||||
<ul>
|
||||
<li><a href="../tutorials/index.html">Tutorial List</a></li>
|
||||
<li><a href="../tutorials/http-client.html">HTTP Client</a></li>
|
||||
<li><a href="../tutorials/websocket-chat.html">WebSocket Chat</a></li>
|
||||
<li><a href="../tutorials/database-app.html">Database App</a></li>
|
||||
<li><a href="../tutorials/template-rendering.html">Templates</a></li>
|
||||
<li><a href="../tutorials/cli-tool.html">CLI Tool</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section">
|
||||
<span class="section-title">How-To Guides</span>
|
||||
<ul>
|
||||
<li><a href="../howto/index.html">How-To List</a></li>
|
||||
<li><a href="../howto/http-requests.html">HTTP Requests</a></li>
|
||||
<li><a href="../howto/json-parsing.html">JSON Parsing</a></li>
|
||||
<li><a href="../howto/regex-patterns.html">Regex Patterns</a></li>
|
||||
<li><a href="../howto/file-operations.html">File Operations</a></li>
|
||||
<li><a href="../howto/async-operations.html">Async Operations</a></li>
|
||||
<li><a href="../howto/error-handling.html">Error Handling</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -93,7 +115,7 @@
|
||||
|
||||
<p>The <code>io</code> module provides file and directory operations, as well as stdin/stdout handling.</p>
|
||||
|
||||
<pre><code>import "io" for File, Directory, Stdin, Stdout</code></pre>
|
||||
<pre><code>import "io" for File, Directory, Stdin, Stdout, Stat</code></pre>
|
||||
|
||||
<h2>File Class</h2>
|
||||
|
||||
@@ -143,7 +165,13 @@ System.print(content)</code></pre>
|
||||
<div class="method-signature">
|
||||
<span class="method-name">File.rename</span>(<span class="param">oldPath</span>, <span class="param">newPath</span>)
|
||||
</div>
|
||||
<p>Renames or moves a file.</p>
|
||||
<p>Renames a file within the same filesystem.</p>
|
||||
|
||||
<div class="method-signature">
|
||||
<span class="method-name">File.move</span>(<span class="param">source</span>, <span class="param">dest</span>)
|
||||
</div>
|
||||
<p>Moves a file from source to destination. Uses libuv's async rename operation.</p>
|
||||
<pre><code>File.move("old/location/file.txt", "new/location/file.txt")</code></pre>
|
||||
|
||||
<h2>Directory Class</h2>
|
||||
|
||||
@@ -214,6 +242,96 @@ System.print("Hello, %(name)!")</code></pre>
|
||||
</div>
|
||||
<p>Flushes the stdout buffer.</p>
|
||||
|
||||
<h2>Stat Class</h2>
|
||||
|
||||
<div class="class-header">
|
||||
<h3>Stat</h3>
|
||||
<p>File metadata and statistics</p>
|
||||
</div>
|
||||
|
||||
<h3>Static Methods</h3>
|
||||
|
||||
<div class="method-signature">
|
||||
<span class="method-name">Stat.path</span>(<span class="param">path</span>) → <span class="type">Stat</span>
|
||||
</div>
|
||||
<p>Returns a Stat object for the specified path.</p>
|
||||
<pre><code>var stat = Stat.path("/etc/hosts")
|
||||
System.print("Size: %(stat.size) bytes")</code></pre>
|
||||
|
||||
<h3>Properties</h3>
|
||||
|
||||
<div class="method-signature">
|
||||
<span class="method-name">size</span> → <span class="type">Num</span>
|
||||
</div>
|
||||
<p>The size of the file in bytes.</p>
|
||||
|
||||
<div class="method-signature">
|
||||
<span class="method-name">isFile</span> → <span class="type">Bool</span>
|
||||
</div>
|
||||
<p>True if the path is a regular file.</p>
|
||||
|
||||
<div class="method-signature">
|
||||
<span class="method-name">isDirectory</span> → <span class="type">Bool</span>
|
||||
</div>
|
||||
<p>True if the path is a directory.</p>
|
||||
|
||||
<div class="method-signature">
|
||||
<span class="method-name">mtime</span> → <span class="type">Num</span>
|
||||
</div>
|
||||
<p>The modification time as a Unix timestamp (seconds since epoch).</p>
|
||||
<pre><code>var stat = Stat.path("file.txt")
|
||||
System.print("Modified: %(stat.mtime)")</code></pre>
|
||||
|
||||
<div class="method-signature">
|
||||
<span class="method-name">atime</span> → <span class="type">Num</span>
|
||||
</div>
|
||||
<p>The access time as a Unix timestamp.</p>
|
||||
|
||||
<div class="method-signature">
|
||||
<span class="method-name">ctime</span> → <span class="type">Num</span>
|
||||
</div>
|
||||
<p>The change time (inode change) as a Unix timestamp.</p>
|
||||
|
||||
<div class="method-signature">
|
||||
<span class="method-name">mode</span> → <span class="type">Num</span>
|
||||
</div>
|
||||
<p>The file permission mode.</p>
|
||||
|
||||
<div class="method-signature">
|
||||
<span class="method-name">inode</span> → <span class="type">Num</span>
|
||||
</div>
|
||||
<p>The inode number.</p>
|
||||
|
||||
<div class="method-signature">
|
||||
<span class="method-name">device</span> → <span class="type">Num</span>
|
||||
</div>
|
||||
<p>The device ID containing the file.</p>
|
||||
|
||||
<div class="method-signature">
|
||||
<span class="method-name">linkCount</span> → <span class="type">Num</span>
|
||||
</div>
|
||||
<p>The number of hard links to the file.</p>
|
||||
|
||||
<div class="method-signature">
|
||||
<span class="method-name">user</span> → <span class="type">Num</span>
|
||||
</div>
|
||||
<p>The user ID of the file owner.</p>
|
||||
|
||||
<div class="method-signature">
|
||||
<span class="method-name">group</span> → <span class="type">Num</span>
|
||||
</div>
|
||||
<p>The group ID of the file.</p>
|
||||
|
||||
<div class="method-signature">
|
||||
<span class="method-name">blockSize</span> → <span class="type">Num</span>
|
||||
</div>
|
||||
<p>The preferred block size for I/O operations.</p>
|
||||
|
||||
<div class="method-signature">
|
||||
<span class="method-name">blockCount</span> → <span class="type">Num</span>
|
||||
</div>
|
||||
<p>The number of blocks allocated for the file.</p>
|
||||
|
||||
<h2>Examples</h2>
|
||||
|
||||
<h3>Reading and Writing Files</h3>
|
||||
|
||||
Reference in New Issue
Block a user