Documentation Index
Fetch the complete documentation index at: https://docs.simular.ai/llms.txt
Use this file to discover all available pages before exploring further.
Class: File
Defined in: index.d.ts:388 Represents a file handle.Constructors
Constructor
new File(Defined in: index.d.ts:396 Creates a handle to a file at the given path. Ifpath,createMissing):File
create_missing is true, the file (and all missing parent
directories) is created when it does not already exist. If false,
the call fails when the file does not exist.
Parameters
path
string
createMissing
boolean
Returns
File
Methods
copyTo()
copyTo(Defined in: index.d.ts:412 Copies the file to a new location, returning a handle to the copy.dest):File
Parameters
dest
string
Returns
File
delete()
delete(): void
Defined in: index.d.ts:419
Deletes the file, invalidating the handle.
Returns
void
extension()
extension():Defined in: index.d.ts:423 Returns the file extension, if any.string|null
Returns
string | null
isReadonly()
isReadonly(): boolean
Defined in: index.d.ts:432
Returns whether the file is read-only.
Returns
boolean
modified()
modified(): number
Defined in: index.d.ts:430
Returns the last modification time as milliseconds since the Unix
epoch.
Returns
number
moveTo()
moveTo(Defined in: index.d.ts:417 Moves the file to a new location. Falls back to copy + delete for cross-device moves.dest):void
Parameters
dest
string
Returns
void
name()
name(): string
Defined in: index.d.ts:421
Returns the file name (last component of the path).
Returns
string
path()
path(): string
Defined in: index.d.ts:398
Returns the resolved absolute path.
Returns
string
read()
read(): string
Defined in: index.d.ts:400
Reads the file and returns its trimmed contents.
Returns
string
rename()
rename(Defined in: index.d.ts:410 Renames the file in place (same parent directory).newName):void
Parameters
newName
string
Returns
void
size()
size(): number
Defined in: index.d.ts:425
Returns the file size in bytes.
Returns
number
write()
write(Defined in: index.d.ts:408 Writes content to the file. Whencontent,append):void
append is true and the file already has content, a newline is
inserted before appending. When append is false, the file is
overwritten. Parent directories are created if needed.
Parameters
content
string
append
boolean
Returns
void
