chunked

0.2.0 Latest release released

chunked

Build Status

Chunked files writer and reader (Can read, for example, S.T.A.L.K.E.R's all.spawn)

Chunked file usually consists of blocks like following: index:T size:T data:[size]

In case of S.T.A.L.K.E.R.'s all.spawn, T will be UInt32

Installation

Add this to your application's shard.yml:

dependencies:
  chunked:
    github: unn4m3d/chunked

Usage

require "chunked"

reader = Chunked::IndexedReader(UInt32).new("path/to/all.spawn")
reader.index_chunks!
reader.chunks #=> [0 => {size: 3, offset: 8, index: 0},1 => {size: 3, offset: 19, index: 1}, ...]
reader[0] #=> Bytes[1u8,2u8,3u8]
reader.info(0) #=> {size: 3, offset: 8, index: 0}
reader.close

# TODO : More examples

Development

TODO

  • Documentation
  • Examples

Contributing

  1. Fork it ( https://github.com/unn4m3d/chunked/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

chunked:
  github: unn4m3d/chunked
  version: ~> 0.2.0
License MIT
Crystal 0.19.4

Authors

Dependencies 1

Development Dependencies 0

Dependents 1

Last synced .
search fire star recently