Delimit.FixedWidth.Reader (delimit v0.4.1)

View Source

Functions for reading fixed-width data from files or strings.

This module handles parsing of fixed-width format data where each field occupies a specific number of characters per line.

Summary

Functions

Reads fixed-width data from a file.

Reads fixed-width data from a string.

Streams fixed-width data from a file.

Functions

read_file(schema, path, opts \\ [])

@spec read_file(Delimit.Schema.t(), Path.t(), Keyword.t()) :: [struct()]

Reads fixed-width data from a file.

Parameters

  • schema - The schema definition
  • path - Path to the fixed-width file
  • opts - Read options

Returns

  • List of structs with parsed data based on schema

read_string(schema, string, opts \\ [])

@spec read_string(Delimit.Schema.t(), binary(), Keyword.t()) :: [struct()]

Reads fixed-width data from a string.

Parameters

  • schema - The schema definition
  • string - String containing fixed-width data
  • opts - Read options

Returns

  • List of structs with parsed data based on schema

stream_file(schema, path, opts \\ [])

@spec stream_file(Delimit.Schema.t(), Path.t(), Keyword.t()) :: Enumerable.t()

Streams fixed-width data from a file.

Parameters

  • schema - The schema definition
  • path - Path to the fixed-width file
  • opts - Read options

Returns

  • Stream of structs with parsed data based on schema