aboutsummaryrefslogtreecommitdiff
path: root/man/man3/tomo-Path.writer.3
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2026-01-02 15:10:48 -0500
committerBruce Hill <bruce@bruce-hill.com>2026-01-02 15:10:48 -0500
commit9653a7c2e53e2bc5e8f146a7d9ea1e71eed19e08 (patch)
tree7f026a142b4f8efcdbf517cc58adc97eb3b37cd5 /man/man3/tomo-Path.writer.3
parente4d5bf73e4ad9dc51f923a32903011edfeae2908 (diff)
parentce49f93da58d007c0a52ee82e2421adfe06012f9 (diff)
Merge branch 'dev' into constructive-reals
Diffstat (limited to 'man/man3/tomo-Path.writer.3')
-rw-r--r--man/man3/tomo-Path.writer.342
1 files changed, 42 insertions, 0 deletions
diff --git a/man/man3/tomo-Path.writer.3 b/man/man3/tomo-Path.writer.3
new file mode 100644
index 00000000..8b3d53d8
--- /dev/null
+++ b/man/man3/tomo-Path.writer.3
@@ -0,0 +1,42 @@
+'\" t
+.\" Copyright (c) 2025 Bruce Hill
+.\" All rights reserved.
+.\"
+.TH Path.writer 3 2025-12-22 "Tomo man-pages"
+.SH NAME
+Path.writer \- create a file writer
+.SH LIBRARY
+Tomo Standard Library
+.SH SYNOPSIS
+.nf
+.BI Path.writer\ :\ func(path:\ Path,\ append:\ Bool\ =\ no,\ permissions:\ Int32\ =\ Int32(0o644)\ ->\ func(text:Text,\ close:Bool=no\ ->\ Result))
+.fi
+.SH DESCRIPTION
+Returns a function that can be used to repeatedly write to the same file.
+
+
+.SH ARGUMENTS
+
+.TS
+allbox;
+lb lb lbx lb
+l l l l.
+Name Type Description Default
+path Path The path of the file to write to. -
+append Bool If set to \fByes\fR, writes to the file will append. If set to \fBno\fR, then the first write to the file will overwrite its contents and subsequent calls will append. no
+permissions Int32 The permissions to set on the file if it is created. Int32(0o644)
+.TE
+.SH RETURN
+Returns a function that can repeatedly write to the same file. If `close` is set to `yes`, then the file will be closed after writing. If this function is called again after closing, the file will be reopened for appending.
+
+.SH NOTES
+The file writer will keep its file descriptor open after each write (unless the `close` argument is set to `yes`). If the file writer is never closed, it will be automatically closed when the file writer is garbage collected.
+
+.SH EXAMPLES
+.EX
+write := (./file.txt).writer()
+write("Hello\[rs]n")!
+write("world\[rs]n", close=yes)!
+.EE
+.SH SEE ALSO
+.BR Tomo-Path (3)