Skip to content

PROPOSAL: Use prettyunits::pretty_bytes to prettify logging for multipart suggestion in put_object #417

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: aws.s3
Type: Package
Title: 'AWS S3' Client Package
Version: 0.3.22
Version: 0.3.23
Authors@R: c(person("Thomas J.", "Leeper", role = "aut",
email = "thosjleeper@gmail.com",
comment = c(ORCID = "0000-0003-4097-6326")),
Expand All @@ -15,6 +15,7 @@ Authors@R: c(person("Thomas J.", "Leeper", role = "aut",
person("Andrii", "Degtiarov", role = "ctb"),
person("Dhruv", "Aggarwal", role = "ctb"),
person("Alyssa", "Columbus", role = "ctb"),
person("Matt", "Kaye", role = "ctb"),
person("Simon", "Urbanek", role = c("cre", "ctb"),
email = "simon.urbanek@R-project.org")
)
Expand All @@ -33,7 +34,8 @@ Imports:
xml2 (> 1.0.0),
base64enc,
digest,
aws.signature (>= 0.3.7)
aws.signature (>= 0.3.7),
prettyunits
Suggests:
testthat,
datasets
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ importFrom(curl,curl)
importFrom(curl,handle_setheaders)
importFrom(curl,new_handle)
importFrom(digest,digest)
importFrom(prettyunits,pretty_bytes)
importFrom(tools,file_ext)
importFrom(tools,md5sum)
importFrom(utils,URLencode)
Expand Down
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# aws.s3 0.3.23

## Features

* `put_object` now uses `prettyunits::pretty_bytes` to prettify log messages printed when suggesting
using `multipart = TRUE`.

# aws.s3 0.3.22

## API changes
Expand Down
3 changes: 2 additions & 1 deletion R/put_object.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
#' @references \href{http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPUT.html}{API Documentation}
#' @seealso \code{\link{put_bucket}}, \code{\link{get_object}}, \code{\link{delete_object}}, \code{\link{put_encryption}}
#' @importFrom utils head
#' @importFrom prettyunits pretty_bytes
#' @export
put_object <-
function(
Expand Down Expand Up @@ -247,7 +248,7 @@ function(
}

if (!is.na(size) && size > partsize)
message("File size is ", size, ", consider setting using multipart=TRUE")
message("File size is ", pretty_bytes(size), ", consider setting using multipart=TRUE")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the meat of it


## httr doesn't support connections so we have to read it all into memory first
if (inherits(what, "connection")) {
Expand Down
Empty file modified man/put_object.Rd
Whitespace-only changes.