Skip to contents

R6 Class representing a resource for managing files' uploads.

Public fields

URL

List of URL endpoints for this resource.

upload_id

Upload ID received after upload initialization.

path

Relative or absolute path to the file on the local disc.

project

Project's identifier (character).

parent

The ID of the folder to which the item is being uploaded. Should not be used together with 'project'.

filename

File name. By default it will be the same as the name of the file you want to upload. However, it can be changed to new name.

overwrite

If TRUE will overwrite file on the server.

file_size

File size.

part_size

Size of part in bytes.

part_length

Number of parts to upload.

parts

List of parts to be uploaded (class Part).

initialized

If TRUE, upload has been initialized.

auth

Authentication object.

Methods


Method new()

Create a new Upload object.

Usage

Upload$new(
  path = NA,
  project = NA,
  parent = NA,
  filename = NA,
  overwrite = FALSE,
  file_size = NA,
  part_size = getOption("sevenbridges2")$RECOMMENDED_PART_SIZE,
  initialized = FALSE,
  auth = NA
)

Arguments

path

Path to the file on the local disc.

project

Project's identifier (character).

parent

The ID of the folder to which the item is being uploaded.

filename

New file name. Optional.

overwrite

If true will overwrite file on the server.

file_size

File size.

part_size

Size of a single part in bytes.

initialized

If TRUE, upload has been initialized.

auth

Seven Bridges Authentication object.


Method print()

Print method for Upload class.

Usage

Upload$print()

Examples

\dontrun{
 upload_object <- Upload$new(
                    path = "path/to/my/file.txt",
                    project = project_object,
                    auth = auth
                   )

 # Print upload object information
 upload_object$print(name = name)
}


Method init()

Initialize new multipart file upload.

Usage

Upload$init()

Examples

\dontrun{
 upload_object <- Upload$new(
                    path = "path/to/my/file.txt",
                    project = project_object,
                    auth = auth
                   )

 # Initialize multipart file upload object
 upload_object$init()
}


Method info()

Get the details of an active multipart upload.

Usage

Upload$info(list_parts = FALSE)

Arguments

list_parts

If TRUE, also return a list of parts that have been reported as completed for this multipart upload. Please bear in mind that the output could be heavy for printing if there are lot of parts.

Examples

\dontrun{
 upload_object <- Upload$new(
                    path = "path/to/my/file.txt",
                    project = project_object,
                    auth = auth
                   )

 # Get upload job status information
 upload_object$info()
}


Method start()

Start the file upload

Usage

Upload$start()

Returns

File object.

Examples

\dontrun{
 upload_object <- Upload$new(
                    path = "path/to/my/file.txt",
                    project = project_object,
                    auth = auth
                   )

 # Initialize multipart file upload object
 upload_object$init()

 # Start upload process
 upload_object$start()
}


Method abort()

Abort the multipart upload This call aborts an ongoing upload.

Usage

Upload$abort()

Examples

\dontrun{
 upload_object <- Upload$new(
                    path = "path/to/my/file.txt",
                    project = project_object,
                    auth = auth
                   )

 # Abort upload process
 upload_object$abort()
}


Method clone()

The objects of this class are cloneable with this method.

Usage

Upload$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples


## ------------------------------------------------
## Method `Upload$print`
## ------------------------------------------------

if (FALSE) {
 upload_object <- Upload$new(
                    path = "path/to/my/file.txt",
                    project = project_object,
                    auth = auth
                   )

 # Print upload object information
 upload_object$print(name = name)
}


## ------------------------------------------------
## Method `Upload$init`
## ------------------------------------------------

if (FALSE) {
 upload_object <- Upload$new(
                    path = "path/to/my/file.txt",
                    project = project_object,
                    auth = auth
                   )

 # Initialize multipart file upload object
 upload_object$init()
}

## ------------------------------------------------
## Method `Upload$info`
## ------------------------------------------------

if (FALSE) {
 upload_object <- Upload$new(
                    path = "path/to/my/file.txt",
                    project = project_object,
                    auth = auth
                   )

 # Get upload job status information
 upload_object$info()
}

## ------------------------------------------------
## Method `Upload$start`
## ------------------------------------------------

if (FALSE) {
 upload_object <- Upload$new(
                    path = "path/to/my/file.txt",
                    project = project_object,
                    auth = auth
                   )

 # Initialize multipart file upload object
 upload_object$init()

 # Start upload process
 upload_object$start()
}


## ------------------------------------------------
## Method `Upload$abort`
## ------------------------------------------------

if (FALSE) {
 upload_object <- Upload$new(
                    path = "path/to/my/file.txt",
                    project = project_object,
                    auth = auth
                   )

 # Abort upload process
 upload_object$abort()
}