File()

NES2+Syntax

new File(path)

Description

The File object allows you to perform various tasks such as reading and writing to a file on your disk. The object itself has many methods to use and a prototype property that allows a programmer to create new properties and methods of the object. Table 8.14 lists the methods accessible and a brief description of each. An instance of this object is created by simply passing the path of the file you want to create or read.

Table 8.14. Methods of the File Object
MethodDescription
byteToString()Converts the byte number passed into its string equivalent
clearError()Clears the File.eof() and File.error() error status
close()Closes the file you opened
eof()Returns true if you are at the end of the file ...

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.