knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
dbflobr
reads and writes files to SQLite databases as flobs.
A flob is a blob that preserves the file extension.
To install the latest release from CRAN
install.packages("dbflobr")
To install the developmental version from GitHub
# install.packages("remotes") remotes::install_github("poissonconsulting/dbflobr")
library(dbflobr) # convert a file to flob using flobr flob <- flobr::flob(system.file("extdata", "flobr.pdf", package = "flobr")) str(flob) # create a SQLite database connection conn <- DBI::dbConnect(RSQLite::SQLite(), ":memory:") # create a table 'Table1' of data DBI::dbWriteTable(conn, "Table1", data.frame(IntColumn = c(1L, 2L))) DBI::dbReadTable(conn, "Table1") # specify which row to add the flob to by providing a key key <- data.frame(IntColumn = 2L) # write the flob to the database in column 'BlobColumn' write_flob(flob, "BlobColumn", "Table1", key, conn, exists = FALSE) DBI::dbReadTable(conn, "Table1") # read the flob flob2 <- read_flob("BlobColumn", "Table1", key, conn) str(flob2) # delete the flob delete_flob("BlobColumn", "Table1", key, conn) DBI::dbReadTable(conn, "Table1") # close the connection DBI::dbDisconnect(conn)
Please report any issues.
Pull requests are always welcome.
Please note that the dbflobr project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.