2016-02-14 00:44:30 +00:00
|
|
|
# bitser
|
|
|
|
|
2016-02-15 13:34:52 +00:00
|
|
|
[![Build Status](https://travis-ci.org/gvx/bitser.svg?branch=master)](https://travis-ci.org/gvx/bitser)
|
2016-02-15 14:20:55 +00:00
|
|
|
[![Coverage Status](https://coveralls.io/repos/github/gvx/bitser/badge.svg?branch=master)](https://coveralls.io/github/gvx/bitser?branch=master)
|
2016-02-15 13:34:52 +00:00
|
|
|
|
2016-02-14 03:30:05 +00:00
|
|
|
Serializes and deserializes Lua values with LuaJIT.
|
|
|
|
|
|
|
|
local bitser = require 'bitser'
|
|
|
|
|
|
|
|
bitser.register('someResource', someResource)
|
|
|
|
bitser.registerClass(SomeClass)
|
|
|
|
|
2016-02-16 01:26:13 +00:00
|
|
|
serializedString = bitser.dumps(someValue)
|
|
|
|
someValue = bitser.loads(serializedString)
|
|
|
|
serializedData = love.filesystem.newFileData("filename")
|
2016-02-16 01:45:24 +00:00
|
|
|
someValue = bitser.loadData(serializedData:getPointer(), serializedData:getSize())
|
2016-02-14 03:30:05 +00:00
|
|
|
|
|
|
|
Pull requests, bug reports and other feedback welcome! :heart:
|
|
|
|
|
2016-02-16 01:35:43 +00:00
|
|
|
Bitser is released under the ISC license (functionally equivalent to the BSD
|
|
|
|
2-Clause and MIT licenses).
|
|
|
|
|
2016-02-14 03:30:05 +00:00
|
|
|
## Why would I use this?
|
|
|
|
|
|
|
|
Because it's fast. Because it produces tiny output. Because the name means "snappier"
|
2016-02-16 01:45:24 +00:00
|
|
|
or "unfriendlier" in Dutch. Because it's safe to use with untrusted data.
|
2016-02-14 03:30:05 +00:00
|
|
|
|
|
|
|
Because it's inspired by [binser](https://github.com/bakpakin/binser), which is great.
|
|
|
|
|
|
|
|
## How do I use the benchmark thingy?
|
|
|
|
|
|
|
|
Download zero or more of [binser.lua](https://github.com/bakpakin/binser/master/binser.lua),
|
|
|
|
[ser.lua](https://github.com.com/gvx/Ser/master/ser.lua),
|
2016-02-16 22:51:15 +00:00
|
|
|
[smallfolk.lua](https://github.com/gvx/Smallfolk/raw/master/smallfolk.lua),
|
|
|
|
[serpent.lua](https://github.com/pkulchenko/serpent/raw/master/src/serpent.lua) and
|
|
|
|
[MessagePack.lua](https://github.com/fperrad/lua-MessagePack/raw/master/src/MessagePack.lua), and run:
|
2016-02-14 03:30:05 +00:00
|
|
|
|
|
|
|
love .
|
|
|
|
|
|
|
|
You do need [LÖVE](https://love2d.org/) for that.
|
|
|
|
|
|
|
|
You can add more cases in the folder `cases/` (check out `_new.lua`), and add other
|
|
|
|
serializers to the benchmark in `main.lua`. If you do either of those things, please
|
|
|
|
send me a pull request!
|
|
|
|
|
|
|
|
## You can register classes?
|
|
|
|
|
|
|
|
Yes. At the moment, bitser supports MiddleClass, SECL, hump.class and Slither (and
|
|
|
|
probably some other class libraries by accident).
|