Logo GenPRES

FileWriterAgent Module

Types

Type Description

FileWriterMsg

Messages for the file writer agent

State

Functions and values

Function or value Description

append path lines writer

Full Usage: append path lines writer

Parameters:
Returns: Agent<FileWriterMsg>
path : string
lines : string[]
writer : Agent<FileWriterMsg>
Returns: Agent<FileWriterMsg>

clear path writer

Full Usage: clear path writer

Parameters:
Returns: Agent<FileWriterMsg>
path : string
writer : Agent<FileWriterMsg>
Returns: Agent<FileWriterMsg>

close path writer

Full Usage: close path writer

Parameters:
Returns: Agent<FileWriterMsg>
path : string
writer : Agent<FileWriterMsg>
Returns: Agent<FileWriterMsg>

create ()

Full Usage: create ()

Parameters:
    () : unit

Returns: Agent<FileWriterMsg>
() : unit
Returns: Agent<FileWriterMsg>

detectEncoding path

Full Usage: detectEncoding path

Parameters:
    path : string

Returns: Encoding

Try to detect BOM-based encoding. Fallback to UTF-8 (no BOM).

path : string
Returns: Encoding

flush writer

Full Usage: flush writer

Parameters:
Returns: Agent<FileWriterMsg>

flushAsync writer

Full Usage: flushAsync writer

Parameters:
Returns: Async<unit>
writer : Agent<FileWriterMsg>
Returns: Async<unit>

getWriter st path

Full Usage: getWriter st path

Parameters:
    st : State
    path : string

Returns: StreamWriter
st : State
path : string
Returns: StreamWriter

openWriter path

Full Usage: openWriter path

Parameters:
    path : string

Returns: StreamWriter

Open a new StreamWriter with sharing that allows editors to truncate/replace. Always write UTF-8 without BOM to avoid hidden preambles/nonprintable characters.

path : string
Returns: StreamWriter

removeWriter st path

Full Usage: removeWriter st path

Parameters:
    st : State
    path : string

st : State
path : string

stop writer

Full Usage: stop writer

Parameters:
Returns: Agent<FileWriterMsg>

stopAsync writer

Full Usage: stopAsync writer

Parameters:
Returns: Async<unit>
writer : Agent<FileWriterMsg>
Returns: Async<unit>

utf8NoBom

Full Usage: utf8NoBom

Returns: Encoding
Returns: Encoding

writeLines st path lines

Full Usage: writeLines st path lines

Parameters:
    st : State
    path : string
    lines : string[]

Write lines; if a failure happens (file deleted, replaced, truncated), reopen once and retry.

st : State
path : string
lines : string[]

Type something to start searching.