Retrieve the size (bytes) of the named xattr
get_xattr_size(path, name, follow_symlinks = TRUE)
path | target path (file or dir); this is auto-expanded |
---|---|
name | xattr name to retrieve |
follow_symlinks | if |
# 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#> 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#> [1] TRUE#> [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#> [1] "is.rud.setting.a" "is.rud.setting.b"#> # 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]>#> character(0)# cleanup unlink(tf)