Filesystem path target extended attributes store extra, customizable, small bits of info. For example, author name, file character encoding, short comments, security status, etc. Methods are provided to list, extract and work with these attributes.

Examples

# Create a temp file for the example tf <- tempfile(fileext = ".csv") write.csv(mtcars, tf) # has attributes? (shld be FALSE) has_xattrs(tf)
#> [1] FALSE
get_xattr(tf, "is.rud.setting")
#> character(0)
# set an attribute set_xattr(tf, "is.rud.setting.a", "first attribut") get_xattr(tf, "is.rud.setting.a")
#> [1] "first attribut"
get_xattr_size(tf, "is.rud.setting.a")
#> [1] 14
# shld be TRUE has_xattrs(tf)
#> [1] TRUE
set_xattr(tf, "is.rud.setting.b", "second attribute") get_xattr(tf, "is.rud.setting.b")
#> [1] "second attribute"
get_xattr_size(tf, "is.rud.setting.b")
#> [1] 16
# overwrite an attribute set_xattr(tf, "is.rud.setting.a", "first attribute") get_xattr(tf, "is.rud.setting.a")
#> [1] "first attribute"
get_xattr_size(tf, "is.rud.setting.a")
#> [1] 15
# see all the attributes list_xattrs(tf)
#> [1] "is.rud.setting.a" "is.rud.setting.b"
# data frame vs individual functions get_xattr_df(tf)
#> # A tibble: 2 x 3 #> name size contents #> <chr> <dbl> <list> #> 1 is.rud.setting.a 15 <raw [15]> #> 2 is.rud.setting.b 16 <raw [16]>
# remove attribute rm_xattr(tf, "is.rud.setting") get_xattr(tf, "is.rud.setting")
#> character(0)
# cleanup unlink(tf)