File.byteToString()

NES2+Syntax

File.byteToString(num)

Description

The byteToString() method of the File object is used to convert the numeric value passed to its ASCII equivalent. If the method is not passed a number, an empty string is returned.

Example

Listing 8.71 opens two files, one for reading and the other for appending. Bytes are then read using the readByte() method from the first file, converted back to string characters using the byteToString() method, and written to the second file. Both files are closed when the process has completed.

Listing 8.71 Using the byteToString() Method to Convert the Bytes Read into Strings
 <SERVER> // Open a log file and a summary file var myLog = new File("/data/logs/today.log"); var mySummary ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.