IO
(in ./Carbon/IO.lua)Provides async and sync I/O operations that work on multiple platforms.
Methods
class public IO.Open(string path, [string mode, Nanotube tube]
)
Returns File
- required
path
: The path to the file to open. - optional
mode
: The file mode to open the file with. Defaults to "rb". - optional
tube
: The Nanotube object to cycle file events through with asynchronous I/O calls on this file.
Opens a new File object.
class public IO.Close(File self
)
Returns void
object public File:Close()
Returns void
Closes the file.
class public IO.Read(File self
)
Returns string
object public File:Read()
Returns void
Reads the entire contents of the file.
class public IO.ReadBufferAsync(File self, [list<string> into]
)
object public File:ReadBufferAsync([list<string> into]
)
- optional
into
: A list to write the output into instead of creating a new buffer.
Reads a file and amortizes its loading through an event loop. Returns the raw buffer, containing a series of strings.
class public IO.ReadBufferAsync(File self
)
object public File:ReadBufferAsync()
Reads a file and amortizes its loading through an event loop.
The same as File:ReadAsync()
class public IO.ReadFileAsync(string path, [Nanotube tube]
)
Returns Promise<string>
- required
path
: The path to the file to read. - optional
tube
: The Nanotube object to cycle events through. Defaults to the global tube.
Opens a file by a path and returns its contents through a Promise.
class public IO.Write(File self, string contents
)
Returns void
object public File:Write(string contents
)
Returns void
- required
contents
: The file contents
Writes to the file.
Properties
[none]