Skip to content

Commit 971125d

Browse files
read_parquet() from URL
1 parent f711ce2 commit 971125d

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# nanoparquet (development version)
22

3+
* `read_parquet()` can now read files from URLs.
4+
35
# nanoparquet 0.4.2
46

57
* `write_parquet()` now does not fail when writing files with a zero-length

R/read-parquet.R

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ read_parquet <- function(file, col_select = NULL,
3232
on.exit(unlink(tmp), add = TRUE)
3333
dump_connection(file, tmp)
3434
file <- tmp
35+
} else if (is.character(file) && length(file) == 1 && any(startsWith(file, c("https://", "http://")))) {
36+
tmp <- tempfile(fileext = ".parquet")
37+
on.exit(unlink(tmp), add = TRUE)
38+
suppressWarnings(download.file(file, destfile = tmp, quiet = TRUE, mode = "wb"))
39+
file <- tmp
3540
}
3641
file <- path.expand(file)
3742

0 commit comments

Comments
 (0)