Write PPS data in native data format
ppsService.writeNativeData(fd, ppsdata, errorlistener);
Argument | Type | Description |
---|---|---|
fd | Integer | A file descriptor with write permission, returned by ppsService.open(). Required. |
ppsdata | String | PPS data in native PPS object format. Required. |
errorlistener | Function | The callback function that gets called if an error occurs. Required. See errorListener() for details. |
The ppsService.writeNative() method writes the data specified in the ppsdata argument to the PPS object represented by the file descriptor specified in the fd argument. The specified data should be in native PPS format.
True on success, false otherwise.
var PATH = '/pps/person'; var errorHandler = function(fd, errorID, errorMessage) { // handle the error console.log('FD: %d, Error ID: %d, Message: %s.', fd, errorID, errorMessage); } // open for write, create the file if it does not exist. var fd_wrt = ppsService.open(PATH, ppsService.FLAG_WRONLY | ppsService.FLAG_CREAT | ppsService.FLAG_TRUNC, ppsService.MODE_IRWXU | ppsService.MODE_IRWXG | ppsService.MODE_IRWXO, errorHandler); if (fd_wrt < 1) { console.log('Open for write failed.'); } // write PPS data in native format var PPS_NATIVE_DATA = 'name::John\nage:n:31\ncity::New York'; if (fd_wrt > 1 && !ppsService.writeNativeData(fd_wrt, PPS_NATIVE_DATA, errorHandler)) { console.log('Write PPS data in native format failed, FD: %d.', fd_wrt); }