Vortex Docs
  • Introduction
  • Getting Started
  • Language Reference
    • Core Functionality
    • Built-in Functions
    • Hooks
    • C Interoperability
    • Coroutines
    • Decorators
    • Type Hinting
    • Error Handling
  • Examples
    • Data Structures
    • Hooks
    • Fetching Data
    • Sockets
    • Event Bus
  • Standard Modules
    • Functional
    • Functools
    • Future
    • I/O
    • JSON
    • Logging
    • Math
    • OS
    • Random
    • Requests
    • SDL
    • SQLite
    • String
    • Sys
    • Time
    • Crypto
    • Websockets
  • Development Roadmap
Powered by GitBook
On this page
  1. Standard Modules

I/O

The 'io' module provides functionality to interact with files

Function Signatures

// File open modes
const OpenMode = {
    app: 1,
    read: 8,
    write: 16,
    trunc: 32,
}

// Open a file with specified file path and open mode.
const open = (filePath: String, openMode: Number = OpenMode.read) => Pointer

// Close a file with given file handle.
const close = (fileHandle: Pointer) => None

// Read from a file with given file handle.
const read = (fileHandle: Pointer) => String

// Write content to a file with given file handle.
const write = (fileHandle: Pointer, content: String) => None

// Read input from standard input.
const input = () => String

// Read content from a file with specified file path. Automatically handles closing the file.
const readf = (filePath: String) => String

// Write content to a file with specified file path, truncating existing content. Automatically handles closing the file.
const writef = (filePath: String, content: String) => String

// Append content to a file with specified file path. Automatically handles closing the file.
const appendf = (filePath: String, content: String) => String
PreviousFutureNextJSON

Last updated 1 year ago