Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
57 lines (43 sloc) 1.48 KB
%% Copyright 2011, Filipe David Manana <>
%% Web:
%% 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
%% 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.
-export([compress/1, decompress/1]).
-export([uncompressed_length/1, is_valid/1]).
init() ->
SoName = case code:priv_dir(?MODULE) of
{error, bad_name} ->
case filelib:is_dir(filename:join(["..", "priv"])) of
true ->
filename:join(["..", "priv", "snappy_nif"]);
false ->
filename:join(["priv", "snappy_nif"])
Dir ->
filename:join(Dir, "snappy_nif")
(catch erlang:load_nif(SoName, 0)),
case erlang:system_info(otp_release) of
"R13B03" -> true;
_ -> ok
compress(_IoList) ->
decompress(_IoList) ->
uncompressed_length(_IoList) ->
is_valid(_IoList) ->
Jump to Line
Something went wrong with that request. Please try again.