Package 'filebin'

Title: Wrapper for the Filebin File Sharing API
Description: A wrapper for the Filebin API. Filebin implements convenient file sharing on the web.
Authors: Andrew B. Collier [aut, cre, cph]
Maintainer: Andrew B. Collier <[email protected]>
License: GPL-3
Version: 0.0.6
Built: 2024-10-25 03:16:22 UTC
Source: https://github.com/datawookie/filebin

Help Index


Set or query API base URL

Description

Set or query API base URL

Usage

base_url(url = NULL)

Arguments

url

Base URL.

Value

URL string.

Examples

base_url("https://testnet.binance.vision/")

Get contents of bin as archive

Description

Get contents of bin as archive

Usage

bin_archive(bin, format = "zip", file = NA)

Arguments

bin

Bin name. If NA the generate random bin name.

format

Archive format. Either "zip" (default) or "tar".

file

File name to use to save results.

Value

File name as character vector.

Examples

## Not run: 
bin_archive("placeholder", file = tempfile(fileext = ".zip"))

## End(Not run)

Delete a bin from Filebin

Description

Delete a bin from Filebin

Usage

bin_delete(bin)

Arguments

bin

Bin name. If NA the generate random bin name.

Value

A Boolean indicating whether bin was successfully deleted.

Examples

## Not run: 
bin_delete("placeholder")
bin_delete("https://filebin.net/placeholder/")

## End(Not run)

Retrieve a bin from Filebin

Description

Retrieve a bin from Filebin

Usage

bin_get(bin)

Arguments

bin

Bin name. If NA the generate random bin name.

Value

A tibble.

Examples

## Not run: 
posted <- file_post(LOREM_IPSUM)
bin_get(posted$bin)

## End(Not run)

Lock a bin on Filebin

Description

Lock a bin on Filebin

Usage

bin_lock(bin)

Arguments

bin

Bin name. If NA the generate random bin name.

Value

A Boolean.

Examples

## Not run: 
posted <- file_post(LOREM_IPSUM)
bin_get(posted$bin)

## End(Not run)

Create random bin name for Filebin

Description

Create random bin name for Filebin

Usage

bin_name_random(length = 16, pattern = "[a-z0-9]")

Arguments

length

Number of characters in bin name. Must be 8 or more.

pattern

Character set.

Value

A character vector.

Examples

bin_name_random(8)

Get QR code for bin on Filebin

Description

Get QR code for bin on Filebin

Usage

bin_qr_code(bin, file = NA)

Arguments

bin

Bin name. If NA the generate random bin name.

file

File name to use to save results.

Value

File name of the archive.

Examples

## Not run: 
posted <- file_post(LOREM_IPSUM, bin = "latin-text")
bin_qr_code("latin-text", file = tempfile(fileext = ".png"))

## End(Not run)

Delete a file from Filebin

Description

Delete a file from Filebin

Usage

file_delete(filename, bin)

Arguments

filename

File name or URL.

bin

Bin name. If NA the generate random bin name.

Value

A Boolean indicating whether file was successfully deleted.

Examples

## Not run: 
posted <- file_post(LOREM_IPSUM, bin = "latin-text")

file_delete("lorem-ipsum.txt", "latin-text")
file_delete("https://filebin.net/latin-text/lorem-ipsum.txt")

## End(Not run)

Retrieve a file from Filebin

Description

Retrieve a file from Filebin

Usage

file_get(filename, bin, file = NA, overwrite = FALSE)

Arguments

filename

File name or URL.

bin

Bin name. If NA the generate random bin name.

file

File name to use to save results. If FALSE then don't save to file.

overwrite

Whether to overwrite existing file.

Value

Contents of file.

Examples

## Not run: 
posted <- file_post(LOREM_IPSUM, bin = "latin-text")

# Discard path and just retain filename.
filename <- basename(LOREM_IPSUM)
file_get(filename, "latin-text")

# Delete downloaded file.
file.remove(filename)

## End(Not run)

Upload a file to Filebin

Description

Upload a file to Filebin

Usage

file_post(path, bin = NA)

Arguments

path

Path to a file. If a vector then upload multiple files.

bin

Bin name. If NA the generate random bin name.

Value

A tibble.

Examples

## Not run: 
# Upload a single file.
file_post(LOREM_IPSUM)
# Upload multiple files.
file_post(c(LOREM_IPSUM, MORE_LOREM_IPSUM))

# Upload to a specific bin.
bin <- bin_name_random(length = 24)
file_post(LOREM_IPSUM, bin)

## End(Not run)

Paths of sample data files

Description

Paths of sample data files

Usage

LOREM_IPSUM

MORE_LOREM_IPSUM

Format

An object of class NULL of length 0.

An object of class NULL of length 0.