Skip to content

Move Filesystem APIs to std.Io #25738

Closed
Closed

Description

@andrewrk

Extracted from #25592.

All of std.fs, std.fs.File, and std.fs.Dir should be deprecated and implementations moved to std.Io.File and std.Io.Dir.

To close the issue std.Io.Threaded must implement all the APIs, including these which currently have @panic stubs:

  • dirStat
  • fileSeekBy
  • dirMakePath
  • openSelfExe
  • fileWritePositional
  • fileWriteStreaming

Activity

  1. added this to the urgent milestone on Oct 29, 2025
  2. added
    enhancement
    breaking
    standard library
    on Oct 29, 2025
  3. leroycep commented on Nov 4, 2025

    @leroycep
    Contributor

    I made a table comparing the functions from std.fs.Dir with the std.Io.VTable fields:

    fs.Dir fn Io.VTable field Variants Notes
    iterate accompanying Iterator struct
    iterateAssumeFirstIteration accompanying Iterator struct
    walkSelectively accompanying SelectiveWalker struct
    walk accompanying Walker struct
    close dirClose
    openFile dirOpenFile
    createFile dirCreateFile
    makeDir dirMake Z, W Z and W variants deprecated
    makePath dirMakePath Io.Dir.makePath does not use the Io.VTable field
    makePathStatus Should this be part of the VTable?
    makeOpenPath dirMakeOpenPath
    realpath Z, W, W2, Alloc #19353
    setAsCwd
    openDir dirOpenDir
    deleteFile Z, W
    deleteDir Z, W
    rename Z, W
    symLink Z, W, Wasi
    atomicSymLink
    readLink Z, W, Wasi
    readFile Alloc, AllocOptions implemented in terms of VTable
    deleteTree
    deleteTreeMinStackSize
    writeFile
    access dirAccess
    copyFile
    atomicFile
    stat dirStat
    statFile dirStatPath
    chmod
    chown
    setPermissions

    Here's a similar table for std.fs.File:

    fs.File fn Io.VTable field Notes
    stdout
    stderr
    stdin
    close fileClose
    sync
    isTty
    isCygwinPty
    getOrEnableAnsiEscapeSupport
    supportsAnsiEscapeCodes
    setEndPos
    seekBy fileSeekBy
    seekFromEnd
    seekTo fileSeekTo
    getPos
    getEndPos
    mode
    stat fileStat
    chmod
    chown
    setPermissions
    updateTimes
    read deprecated in favor of fileReadStreaming, I assume
    pread deprecated in favor of fileReadPositional, I assume
    preadAll /// Deprecated in favor of Reader.
    readv fileReadStreaming #7699
    preadv fileReadPositional #7699
    write deprecated in favor of fileWriteStreaming, I assume
    writeAll deprecated in favor of fileWriteStreaming, I assume
    pwriteAll /// Deprecated in favor of Writer.
    pwrite deprecated in favor of fileWritePositional, I assume
    writev fileWriteStreaming #7699
    pwritev fileWritePositional #7699
    copyRange /// Deprecated in favor of Writer.
    copyRangeAll /// Deprecated in favor of Writer.
    lock
    unlock
    tryLock
    downgradeLock
    • Should std.Io.Dir.cwd() be part of the Io interface?
    • std.fs.File.Writer needs to be moved into std.Io.File.
  4. francisqureshi commented on Nov 17, 2025

    @francisqureshi

    FYI: I am sure you all know, but I think currently std.Io.File.readPositional’s fn signature is borked and expects a buffer []u8 vs the vtable which takes a data: [][]u8 ?

    😙

  5. hugomano commented on Nov 26, 2025

    @hugomano

    @leroycep on Should std.Io.Dir.cwd() be part of the Io interface? : it's a big yes for us because this unlock the implementation of virtual filesystems on top of the IO interface.

  6. modified the milestones: urgent, 0.16.0 on Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    breakingenhancementstandard library

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions