Files & processes · BUILT-IN MODULE

file

File reading, writing, copy, move, and directory helpers.

Quick start

use file
use file

text = try file.read "notes.txt"
say text
try file.write "copy.txt" text

API reference

file.read path

Read a file. Fallible.

讀取檔案。此操作可能失敗。
file.write path text

Write a file. Fallible.

寫入檔案。此操作可能失敗。
file.append path text

Append Text to a file. Fallible.

將 Text 追加到檔案。此操作可能失敗。
file.open path

Open a file handle. Fallible.

開啟檔案 handle。此操作可能失敗。
file.copy source target

Copy a file. Fallible.

複製檔案。此操作可能失敗。
file.move source target

Move or rename a path. Fallible.

移動或重新命名路徑。此操作可能失敗。
file.copytree source target

Recursively copy a directory. Fallible.

遞迴複製目錄。此操作可能失敗。
file.remove path

Remove a file or directory tree. Fallible.

移除檔案或整個目錄樹。此操作可能失敗。
file.mkdir path

Create directories. Fallible.

建立目錄。此操作可能失敗。