with.sshfs_mount_point: Evaluate expressions with mounted directory

View source: R/with-mount.R

with.sshfs_mount_pointR Documentation

Evaluate expressions with mounted directory

Description

SSHFS can be a bit finicky and fail when reading lots of files. It can be safer, then, to mount and unmount the folder each time you read each file.

Usage

## S3 method for class 'sshfs_mount_point'
with(data, expr, ...)

Arguments

data

a mount object returned by [sshfs_mount()]

expr

any R expression thet will be evaluated.

...

ignored

Details

The function mounts the remote folder, evaluates the expresion and then unmounts. The 'expr' can access the locally-mounted folder with the '.folder' variable.

Examples

## Not run: 
mount <- sshfs_mount("user", "remote.server.com", "~/data_folder", "~/loca_folder")
bici <- with(mount, read.csv(file.path(.folder, "some_file.csv")))

## End(Not run)

eliocamp/mountr documentation built on May 25, 2023, 7:35 p.m.