ftp

knitr::opts_chunk$set(
  comment = "#>",
  collapse = TRUE,
  warning = FALSE,
  message = FALSE
)

Build Status

An FTP client for R

not quite ready to use yet

The File Transfer Protocol (FTP) is a standard network protocol used for the transfer of computer files from a server to a client using the Client–server model on a computer network.

See the ftp info vignette for detailed FTP information.

Installation

remotes::install_github("sckott/ftp")
library('ftp')

list files

ftp_list("ftp://ftp.ncdc.noaa.gov/pub/data/ghcn/daily/")
ftp_list("ftp://ftp.ncdc.noaa.gov/pub/data/ghcn/daily/by_year/")
ftp_list("ftp://ftp.ncdc.noaa.gov/pub/data/noaa/2014/")
# just list files
ftp_list("ftp://ftp.ncdc.noaa.gov/pub/data/ghcn/daily/", just_list = TRUE)

fetch files

url <- "ftp://ftp.ncdc.noaa.gov/pub/data/ghcn/daily/by_year/1882.csv.gz"
file <- tempfile(fileext = ".csv.gz")
ftp_fetch(url, disk = file)
utils::read.delim(file, sep = ",", nrows = 10, header = FALSE)
unlink(file) # cleanup

ftp client

Wraps an R6 method FTPClient

(x <- ftp_client("ftp://ftp.ncdc.noaa.gov/pub/data/ghcn/"))

adjust settings

x$ftp_port()
x$set_pasv()

pwd, working directory

x$pwd()

list files

x$list()

note that parsing isn't working totally yet :)

Meta



sckott/ftp documentation built on Sept. 3, 2020, 7:22 p.m.