|
| 1 | + |
| 2 | +<!-- badges: start --> |
| 3 | +[](https://lifecycle.r-lib.org/articles/stages.html#stable) |
| 4 | +[](https://github.com/tidyverse/blob/actions) |
| 5 | +[](https://cran.r-project.org/package=blob) |
| 6 | +[](https://app.codecov.io/gh/tidyverse/blob) |
| 7 | +<!-- badges: end --> |
| 8 | + |
| 9 | +<!-- README.md is generated from README.Rmd. Please edit that file --> |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | +# blob <a href="https://blob.tidyverse.org"><img src="man/figures/logo.png" align="right" height="122" alt="blob website" /></a> |
| 14 | + |
| 15 | +## Overview |
| 16 | + |
| 17 | +The goal of blob is to provide a simple S3 class to represent a vector of binary objects, aka blobs. The `blob` class is a lightweight wrapper around a list of raw vectors, suitable for inclusion in a data frame. |
| 18 | + |
| 19 | +In most cases you will not need to use this package explicitly: it will be used transparently by packages that need to load BLOB columns from databases or binary file formats. |
| 20 | + |
| 21 | +## Installation |
| 22 | + |
| 23 | +```r |
| 24 | +# The easiest way to get blob is to install the whole tidyverse: |
| 25 | +install.packages("tidyverse") |
| 26 | + |
| 27 | +# Alternatively, install just blob: |
| 28 | +install.packages("blob") |
| 29 | + |
| 30 | +# Or the the development version from GitHub: |
| 31 | +# install.packages("pak") |
| 32 | +pak::pak("tidyverse/blob") |
| 33 | +``` |
| 34 | + |
| 35 | +## Example |
| 36 | + |
| 37 | +To create a blob, use `blob()`, `new_blob()` or `as_blob()`: |
| 38 | + |
| 39 | + |
| 40 | +``` r |
| 41 | +library(blob) |
| 42 | + |
| 43 | +x1 <- charToRaw("Good morning") |
| 44 | +x2 <- as.raw(c(0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef)) |
| 45 | + |
| 46 | +new_blob(list(x1, x2)) |
| 47 | +#> <blob[2]> |
| 48 | +#> [1] blob[12 B] blob[5 B] |
| 49 | +blob(x1, x2) |
| 50 | +#> <blob[2]> |
| 51 | +#> [1] blob[12 B] blob[5 B] |
| 52 | + |
| 53 | +as_blob(c("Good morning", "Good evening")) |
| 54 | +#> <blob[2]> |
| 55 | +#> [1] blob[12 B] blob[12 B] |
| 56 | +``` |
| 57 | + |
0 commit comments