item_rm_files: Remove files associated with an item

View source: R/item_rm_files.R

item_rm_filesR Documentation

Remove files associated with an item

Description

Removes existing files associated with an item.

NOTE: This function will not alter facets which can also contain facets. To manipulate facets, the facet element of a sciencebase item must be altered and updated with item_update.

This function is the key way to remove files attached to SB items.

Usage

item_rm_files(sb_id, files, ...)

Arguments

sb_id

An sbitem object or a character ScienceBase ID corresponding to the item

files

A character vector of file names to remove. If not supplied, defaults to removing all attached files.

...

Additional parameters are passed on to GET, POST, HEAD, PUT.

Value

An updated object of class sbitem

Examples

## Not run: 
res <- item_create(user_id(), "item456") 
cat("foo bar", file = "foobar.txt")
item_append_files(res, "foobar.txt")
res <- item_get(res)
res$files[[1]]$name
res2 <- item_rm_files(res)
res2$files

## End(Not run)

USGS-R/sbtools documentation built on June 1, 2024, 9:47 p.m.