Skip to content

zencoder/libsmile

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Libsmile

C implementation of the Smile binary format (wiki.fasterxml.com/SmileFormatSpec).

The library ships with a command line tool (unsmile) to decode binary files on the command line, as well as extensions for scripting languages.

Status

libsmile is under heavy development and is still considered experimental.

What is working:

  • Single block decoding smile -> json (up to 64k by default, size can be increased)

  • Shared String references (see below for caveat)

  • Basic PHP, Ruby and Python support

What is missing:

  • The following decoding use cases are not yet supported due to lack of test data (feel free to contribute json/smile samples, see data/ directory): long String, long Shared String reference for Keys decoding, BigInteger, long Unicode String, long Shared String reference, Binary, Raw Binary for Values decoding

  • Streaming support: API has been designed to do chunk decoding, but is not yet functional (only single chunk for now between reset)

  • Encoding support json -> smile

Building on macOS

brew install libtool gcc@9

Then follow the below instructions.

C library build

To build libsmile.la:

make

To run tests:

make check

Extensions build

To build extensions:

make <ext>

To run tests:

make check-<ext>

where ext is php, ruby or py.

Usage

unsmile

libsmile $ ./unsmile 
usage: unsmile <file>

For example:

libsmile $ ./unsmile data/smile/test1.smile 
{"test key":true,"nullField":null,"foo":1,"foo2":{"a":3},"aãb":-323,"2":[1,2,3],"\"foo\"":"foo\nbar"}

C Library

The API can be found under include/smile.h. A good starting point is tools/unsmile.c for a working example.

License (see LICENSE-2.0.txt file for full license)

Copyright 2011 Pierre-Alexandre Meyer

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Releases

No releases published

Packages

No packages published

Languages

  • C 88.1%
  • Makefile 6.0%
  • Ruby 2.3%
  • PHP 1.7%
  • Other 1.9%