File.open()

NES2+Syntax

file.open(option)

Description

The open() method of the File object is used to open a file to read, write, and/or append to. The method returns true if it is successful and false otherwise. The options passed determine the mode in which the file is opened. The options are specified in Table 8.16.

Table 8.16. Options of the open() Method
OptionDescription
aThis option opens a file for appending. If the file does not exist, it is created. This method always returns true.
a+This option opens a file for reading and appending. If the file does not exist, it is created. This method always returns true.
rThis option opens a file for reading. If the file exists, the method returns true; otherwise, it returns false.
r+This option ...

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.