Four helpers to upload files or directories to your Spaces buckets, never overwriting existing assets. Requires CDN credentials (see README.md).
Usage
write_art_coa(artist, artwork, local_path, delete_local = FALSE)
write_art_public(artist, artwork = NULL, local_path, delete_local = FALSE)
write_art_data(
artist,
artwork,
local_path,
prefix = NULL,
delete_local = FALSE
)
write_art_vault(
artist,
artwork,
local_path,
prefix = NULL,
delete_local = FALSE
)Arguments
- artist
Character(1). UUID of the artist.
- artwork
Character(1). UUID of the artwork (required where noted).
- local_path
Character(1). Path to a local file or directory.
- delete_local
Logical. Delete the local file after a verified upload. Defaults to `FALSE`.
- prefix
Character(1). S3 prefix (for art-data / art-vault)
Details
* `write_art_coa()` writes a single certificate file (pdf or jpeg) to `art-coa` in `issued/artist/artwork/`. * `write_art_public()` writes artist or artwork thumbnails to `art-public` at `thumbnails/artist/` (art image) or `thumbnails/artist/` (artist image) * `write_art_data()` uploads a directory (or single file) into `art-data` at `processed/artist/artwork/` * `write_art_vault()` uploads a directory (or single file) into `art-vault` in `uploads/artist/artwork/`
All helpers error if the target key (or any key under a prefix) already exists.
Functions
write_art_coa(): see details sectionwrite_art_public(): Upload a thumbnail to art-publicwrite_art_data(): Upload processed assets to art-datawrite_art_vault(): Upload an artist's original bundle to art-vault
See also
Other cdn:
cdn-count,
cdn-create,
cdn-helpers,
cdn_asset_url()
Examples
if (FALSE) { # \dontrun{
tmp <- tempfile(fileext = ".pdf")
writeLines("demo", tmp)
write_art_coa(
"11111111-1111-1111-1111-111111111111",
"22222222-2222-2222-2222-222222222222",
tmp
)
} # }
if (FALSE) { # \dontrun{
# 1) Artist thumbnail
thumb <- tempfile(fileext = ".png")
writeLines("png-data", thumb)
write_art_public("abcd1234-artist-uuid", local_path = thumb)
# 2) Artwork thumbnail
thumb2 <- tempfile(fileext = ".jpeg")
writeLines("jpeg-data", thumb2)
write_art_public(
"abcd1234-artist-uuid",
"efgh5678-art-uuid",
thumb2
)
} # }
if (FALSE) { # \dontrun{
# single file
f <- tempfile(fileext = ".txt")
cat("hello", file = f)
write_art_data(
"11111111-1111-1111-1111-111111111111",
"22222222-2222-2222-2222-222222222222",
local_path = f,
prefix = "processed/11111111-1111-1111-1111-111111111111/22222222-2222-2222-2222-222222222222"
)
# directory of files
tmp <- tempfile("artdir_")
fs::dir_create(tmp)
cat("a", file = file.path(tmp, "a.txt"))
cat("b", file = file.path(tmp, "b.txt"))
write_art_data(
"11111111-1111-1111-1111-111111111111",
"22222222-2222-2222-2222-222222222222",
local_path = tmp
)
} # }
if (FALSE) { # \dontrun{
dir_tmp <- fs::dir_create(tmp <- tempfile("vault_"))
writeLines("canvas", file.path(tmp, "canvas.procreate"))
write_art_vault("111...", "222...", tmp)
} # }
