Skip to content

p-x9/swift-fileio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

57 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

FileIO

A Swift library for reading and writing files.

Github issues Github forks Github stars Github top language

Features

Usage

MemoryMappedFile/StreamedFile have the same API available for both.

Available methods are defined in the FileIOProtocol

Design Overview

This library separates file I/O into three orthogonal concerns:

  1. Capability: what operations are supported (_FileIOProtocol)
  2. Role: how the object is used (FileIOProtocol, FileIOSiliceProtocol)
  3. Implementation strategy: how I/O is performed (memory-mapped or streamed)

Protocol Relationships

The following diagram illustrates the relationships between the core protocols in this library.

graph TD
    _FileIOProtocol --> FileIOProtocol
    _FileIOProtocol --> FileIOSiliceProtocol

    _FileIOProtocol --> _MemoryMappedFileIOProtocol
    _FileIOProtocol --> _StreamedFileIOProtocol

    FileIOProtocol --> MemoryMappedFileIOProtocol
    FileIOProtocol --> StreamedFileIOProtocol

    _MemoryMappedFileIOProtocol --> MemoryMappedFileIOProtocol
    _StreamedFileIOProtocol --> StreamedFileIOProtocol

    FileIOProtocol --> FileSlice[associatedtype FileSlice]
    FileSlice --> FileIOSiliceProtocol

    _FileIOProtocol --> ResizableFileIOProtocol
Loading
  • _FileIOProtocol defines the fundamental read/write and synchronization operations.
  • FileIOProtocol extends it with file-opening and slicing capabilities.
  • FileIOSiliceProtocol represents a logical view into a file with a baseOffset.
  • ResizableFileIOProtocol adds structural mutation operations such as insert and delete.
  • _MemoryMappedFileIOProtocol and _StreamedFileIOProtocol describe low-level implementation traits.
  • MemoryMappedFileIOProtocol and StreamedFileIOProtocol combine implementation traits with FileIOProtocol.

License

FileIO is released under the MIT License. See LICENSE

About

๐Ÿ“ A Swift library for reading and writing files.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages