-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7a2e291
Showing
298 changed files
with
119,897 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
Package: zstdr | ||
Type: Package | ||
Title: R Bindings to Zstandard Compression Library | ||
Version: 0.1.0 | ||
Authors@R: c( | ||
person("Konstantin", "Sorokin", email = "kvs@sigterm.ru", role = c("aut", "cre")), | ||
person("Facebook, Inc", role = c("aut","cph"), comment = "Fast real-time compression library") | ||
) | ||
Maintainer: Konstantin Sorokin <kvs@sigterm.ru> | ||
Description: Provides R bindings to the 'Zstandard' compression library. | ||
'Zstandard' is a real-time compression algorithm, providing high compression ratios. | ||
It offers a very wide range of compression / speed trade-off, while being backed by a very fast decoder. | ||
See <http://facebook.github.io/zstd/> for more information. | ||
URL: https://github.com/thekvs/zstdr | ||
BugReports: https://github.com/thekvs/zstdr/issues | ||
License: GPL (>= 2) | ||
LazyData: TRUE | ||
SystemRequirements: C++11 | ||
Imports: Rcpp (>= 0.12.0) | ||
LinkingTo: Rcpp | ||
RoxygenNote: 6.0.1 | ||
Suggests: testthat | ||
OS_type: unix | ||
NeedsCompilation: yes | ||
Packaged: 2017-06-02 09:23:12 UTC; kvs | ||
Author: Konstantin Sorokin [aut, cre], | ||
Facebook, Inc [aut, cph] (Fast real-time compression library) | ||
Repository: CRAN | ||
Date/Publication: 2017-06-02 17:58:31 UTC |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
useDynLib(zstdr) | ||
export( | ||
zstdCompress, | ||
zstdDecompress, | ||
zstdMaxCLevel | ||
) | ||
importFrom(Rcpp, evalCpp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Generated by using Rcpp::compileAttributes() -> do not edit by hand | ||
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 | ||
|
||
zstdCompressImpl <- function(data, level) { | ||
.Call('zstdr_zstdCompressImpl', PACKAGE = 'zstdr', data, level) | ||
} | ||
|
||
zstdDecompressImpl <- function(data) { | ||
.Call('zstdr_zstdDecompressImpl', PACKAGE = 'zstdr', data) | ||
} | ||
|
||
zstdMaxCLevelImpl <- function() { | ||
.Call('zstdr_zstdMaxCLevelImpl', PACKAGE = 'zstdr') | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#' Zstandard comression | ||
#' | ||
#' Zstandard, or zstd as short version, is a fast lossless compression algorithm, targeting real-time compression scenarios | ||
#' at zlib-level and better compression ratios. | ||
#' | ||
#' Compresses data using zstandard algorithm | ||
#' | ||
#' @export | ||
#' @seealso \link{memCompress} \link{zstdDecompress} \link{zstdMaxCLevel} | ||
#' @references \url{http://facebook.github.io/zstd/} | ||
#' @param data input data to be compressed or decomressed | ||
#' @param level compression level to use, value between 1 and returned by \link{zstdMaxCLevel} function, default is 3 | ||
#' @return compressed data | ||
#' @examples # Simple example | ||
#' library(zstdr) | ||
#' data_file <- file.path(R.home(), "COPYING") | ||
#' data <- readBin(data_file, raw(), file.info(data_file)$size) | ||
#' compressed <- zstdCompress(data) | ||
#' stopifnot(identical(data, zstdDecompress(compressed))) | ||
zstdCompress <- function(data, level=3) { | ||
stopifnot(is.numeric(level)) | ||
|
||
if (is.character(data)) { | ||
return(zstdCompressImpl(charToRaw(data), as.integer(level))) | ||
} else if (is.raw(data)) { | ||
return(zstdCompressImpl(data, as.integer(level))) | ||
} else { | ||
stop("data must be of raw or character type") | ||
} | ||
} | ||
|
||
#' Zstandard comression | ||
#' | ||
#' Zstandard, or zstd as short version, is a fast lossless compression algorithm, targeting real-time compression scenarios | ||
#' at zlib-level and better compression ratios. | ||
#' | ||
#' Decompresses data previously compressed with \link{zstdCompress} | ||
#' | ||
#' @export | ||
#' @seealso \link{memCompress} \link{zstdCompress} \link{zstdMaxCLevel} | ||
#' @param data input data to be decomressed | ||
#' @return decompressed data | ||
#' @examples # Simple example | ||
#' library(zstdr) | ||
#' data_file <- file.path(R.home(), "COPYING") | ||
#' data <- readBin(data_file, raw(), file.info(data_file)$size) | ||
#' compressed <- zstdCompress(data) | ||
#' stopifnot(identical(data, zstdDecompress(compressed))) | ||
zstdDecompress <- function(data) { | ||
if (!is.raw(data)) { | ||
stop("input data must be raw") | ||
} | ||
|
||
return(zstdDecompressImpl(data)) | ||
} | ||
|
||
#' Returns maximum compression level supported by zstandard | ||
#' | ||
#' @export | ||
#' @seealso \link{memCompress} \link{zstdCompress} \link{zstdDecompress} | ||
#' @return maximum supported compression level | ||
zstdMaxCLevel <- function() { | ||
return(zstdMaxCLevelImpl()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
[![Build Status](https://travis-ci.org/thekvs/zstdr.svg?branch=master)](https://travis-ci.org/thekvs/zstdr) | ||
|
||
About | ||
----- | ||
|
||
This package provides simple R bindings to the [Zstandard compression library](http://facebook.github.io/zstd/). | ||
|
||
Benchmarks | ||
---------- | ||
|
||
See [benchmarks](Benchmarks.md) for comparison with other compression algorithms. | ||
|
||
Installation | ||
------------ | ||
|
||
For the moment you can only install from GitHub: | ||
|
||
``` r | ||
devtools::install_github("thekvs/zstdr") | ||
``` | ||
|
||
Usage | ||
----- | ||
|
||
``` r | ||
library(zstdr) | ||
|
||
data_file <- file.path(R.home(), "COPYING") | ||
data <- readBin(data_file, raw(), file.info(data_file)$size) | ||
compressed <- zstdCompress(data) | ||
stopifnot(identical(data, zstdDecompress(compressed))) | ||
``` | ||
|
||
Links | ||
----- | ||
|
||
- [zstandard official site](http://facebook.github.io/zstd/) | ||
- [zstandard C API documentation](http://facebook.github.io/zstd/zstd_manual.html) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/sh | ||
|
||
rm -rf autom4te.cache/ config.log config.status \ | ||
src/Makevars src/*.o src/*.so src/*.dylib \ | ||
src/third_party/build src/third_party/install *~ |
Oops, something went wrong.