package mlgpx

  1. Overview
  2. Docs

Module Gpx_eio.IOSource

GPX Eio I/O operations

This module provides GPX I/O operations using Eio's effects-based concurrent I/O system. All operations are structured concurrency compatible and work with Eio's resource management.

File Operations

Sourceval read_file : ?validate:bool -> fs:[> Eio.Fs.dir_ty ] Eio.Path.t -> string -> Gpx.t

Read GPX from file path.

  • parameter fs

    Filesystem capability

  • parameter path

    File path to read

  • parameter ?validate

    Optional validation flag (default: false)

  • returns

    GPX document or error

Sourceval write_file : ?validate:bool -> fs:[> Eio.Fs.dir_ty ] Eio.Path.t -> string -> Gpx.t -> unit

Write GPX to file path.

  • parameter fs

    Filesystem capability

  • parameter path

    File path to write

  • parameter gpx

    GPX document to write

  • parameter ?validate

    Optional validation flag (default: false)

Stream Operations

Read/write GPX from/to Eio flows.

Sourceval read_source : ?validate:bool -> [> Eio.Flow.source_ty ] Eio.Resource.t -> Gpx.t

Read GPX from Eio source.

  • parameter source

    Input flow to read from

  • parameter ?validate

    Optional validation flag (default: false)

  • returns

    GPX document

Sourceval write_sink : ?validate:bool -> [> Eio.Flow.sink_ty ] Eio.Resource.t -> Gpx.t -> unit

Write GPX to Eio sink.

  • parameter sink

    Output flow to write to

  • parameter gpx

    GPX document to write

  • parameter ?validate

    Optional validation flag (default: false)

Utility Functions

Sourceval file_exists : fs:[> Eio.Fs.dir_ty ] Eio.Path.t -> string -> bool

Check if file exists.

  • parameter fs

    Filesystem capability

  • parameter path

    File path to check

  • returns

    true if file exists and is readable

Sourceval file_size : fs:[> Eio.Fs.dir_ty ] Eio.Path.t -> string -> int

Get file size.

  • parameter fs

    Filesystem capability

  • parameter path

    File path

  • returns

    File size in bytes

Sourceval create_backup : fs:[> Eio.Fs.dir_ty ] Eio.Path.t -> string -> string

Create backup of existing file.

  • parameter fs

    Filesystem capability

  • parameter path

    Original file path

  • returns

    Backup file path

Sourceval write_file_with_backup : ?validate:bool -> fs:[> Eio.Fs.dir_ty ] Eio.Path.t -> string -> Gpx.t -> string

Write GPX to file with automatic backup. Creates a backup of existing file before writing new content.

  • parameter fs

    Filesystem capability

  • parameter path

    File path to write

  • parameter gpx

    GPX document to write

  • parameter ?validate

    Optional validation flag (default: false)

  • returns

    Backup file path (empty string if no backup needed)

OCaml

Innovation. Community. Security.