pjs.readIFSFile()



This API reads the entire contents of an IBM i IFS file and performs optional text conversion.

Parameters

  1. Path (String) - Path to the IFS file to read.

  2. CCSID (Number/optional) – The desired CCSID of the returned data. If this parameter is omitted or set to zero, the data will be converted to the CCSID of the IBM i job. If set to 65535 no conversion will be done.

Return Value

A Buffer instance containing the file data.

Exception Handling

An Error instance will be thrown if there are any problems reading the file.

Example

Read Text File as UTF-8, Convert to String and Display
var buffer = pjs.readIFSFile("/home/rfite/myfile.txt", 1208); console.log(buffer.toString("utf8"));