crystal-binary_parser 0.1.1

Binary parser for Crystal

crystal-binary_parser

CircleCI GitHub release

Description

A binary parser for crystal.

Requirement

  • crystal >= 0.20.0

Install

Add this to your shard.yml

dependencies:
  binary_parser:
    github: DanSnow/crystal-binary_parser

Feature

  • Parse and write binary file
  • Support array (fixed size or variable size)
  • Support string (fixed length or valirable length)
  • Support nested parser
  • Support config which endian to use
  • Calculate byte size

Usage

require "binary_parser"

class Parser < BinaryParser
  uint8 :foo
end

# Load a file
parser = Parser.new
parser.load("<filename>")

# Or from IO
io = File.open("<filename>")
parser = Parser.new
parser.load(io)

# Now you can get your data
puts parser.foo

License

MIT

Repository

crystal-binary_parser

Owner
Statistic
  • 18
  • 2
  • 0
  • 1
  • 0
  • over 2 years ago
  • December 10, 2016
License

MIT License

Links
Synced at

Fri, 08 Nov 2024 09:21:55 GMT

Languages