Use this option to set the file name of the file where the header coming from the server will be saved. When you set this option the file is opened and truncated assumed that the program has appropriate privileges. Thus if there was a file with the name the file will be overwrtitten even if the curl::perform function is not called. The file is opened, when the option is set and kept opened so long as the connection is "finished" or another HEADERFILE option is specified for the connection.
Note: You need this option if you want to get the header and the body of a downloaded file into two separate files. You can easily get the header and the body into a single file if you use the option HEADER. Altough there is nothing that prevents, I see no real use of the two options aka HEADERFILE and flag HEADER) together. But you are free to use them together.
Comment on internals (if you do not understand what I am talking about, most probably you do not need to):
The underlying CURL library requests an opened file handle passed to the library and a function that performs the file writing. The ScriptBasic interface gets the name of the file, opens the file, passes the opened file pointer to the library and specifies the stadard fwrite function to write the file.
The pointer to the function fwrite is taken from the support table, thus is any preloaded module altered this before setting this option the module function will be used.
The file is opened calling the system function fopen via the ScriptBasic support function calling stacks. This means that if some module implements a hook function to control file access that will be taken into account the same way as it is taken into accoung in the case of the BASIC command OPEN.