Command: writefile

Syntax

writefile <channel>, <file>

Description

Write the contents of a file to a system output channel.

Parameters

Switches

Notes

When written to a text channel, the file must be a text file. Writing a binary file to a text channel will have an undefined, and probably undesirable, result.

When written to a binary channel (e.g. the FireRender output channel), the file may be text or binary and the output will be wrapped in a Fire Hose Protocol packet of type NET_PACKET_FILE. When the ultimate recipient of the file is a browser, it is advisable to preface this command with a write command specifying the file type in an http header statement, see example below. This write + writefile sequence is typically done only once for each FireRender request.

Examples

Write a binary file.

writefile chan2, myfile.bin

Write an html file with keyword changes to the firerender channel, and ultimately a browser.

# Tell the browser it is an html file
write firerender_channel,'Content-Type: text/html'
writefile firerender_channel, myfile.htm, \ 
   -k=<'host','port'>, \ 
   -t=<'anchovy','3101'>

See Also

Commands:

close, open, write

Identifiers:

chan# (channel), firerender_*