docusealco / docuseal

Open source DocuSign alternative. Create, fill, and sign digital documents ✍️
https://www.docuseal.co
GNU Affero General Public License v3.0
6.23k stars 443 forks source link

Get size of PDF in bytes via API/HEAD #290

Closed KammererTob closed 3 months ago

KammererTob commented 3 months ago

Hi there,

if i am not mistaken there currently is no way to get the actual size in bytes of a signed document via your API. If i do a HEAD request (on the URL starting with "https://docuseal.eu/file/....") i get Content-Length: 0, and it seems there is no other way to retrieve it.

The use-case for me at the moment is to copy signed documents over to our own internal S3 (for backup purposes) in Java. The S3 library there expects a content length for the input stream, otherwise it is buffering the whole file to memory. This usually is not an issue with the file sizes we are dealing with here. But i just want to make sure to not run into any issues down the line.

Is there a way for you to add this, or let me know of a way to already retrieve/get this?

Thanks!

omohokcoj commented 3 months ago

Hi @KammererTob , unfortunately there are no easy ways to add bytes size to the content-length in the HEAD request because rails/puma empties this header on HEAD request. To get content-length it requires to download a file