question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Uploading file from the path but not as a string/buffer?

See original GitHub issue

Before you start Have you checked StackOverflow, previous issues, and Dropbox Developer Forums for help? Yes.

What is your question? I want to implement a direct file uploading from a client to the Dropbox without a need of creating a buffer on the application server. This is critical in case of big files, which can’t be stored as a buffer on the application server in a whole.

I’ve found a thread from 2017: Url of the file instead of a buffer in uploadSessionAppendV2?, where it is stated: «No, unfortunately the API v2 JavaScript SDK only supports supplying the file content as string or buffer, but I’ll be sure to pass this along as a feature request.» Are there any changes since that time?

As a middleware, I’m using formidable, which contains fileWriteStreamHandler: «If you are looking to write the file uploaded in other types of cloud storages (AWS S3, Azure blob storage, Google cloud storage) or private file storage, this is the option you’re looking for.»

Is there any way to forward an uploading file directly to Dropbox and minimize an application server CPU & RAM overloading?

This is especially critically when we’re talking about uploading big files, which application server can’t handle in the RAM in whole.

Versions

  • What version of the SDK are you using? 10.4.3
  • What version of the language are you using? ES-2021
  • Are you using Javascript or Typescript? JS
  • What platform are you using? (if applicable) Node.js

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
greg-dbcommented, Jul 17, 2021

It’s not possible to securely hide an access token on the client, so if you’re using an access token that the end-user shouldn’t have access to, you do need to make sure you do not send it to the client at all. (The typical way of using the Dropbox API is that the end-user would interact with their own account, so it’s okay for them to have access to the access token since it’s just for their own account.)

In this case though, you should look into the filesGetTemporaryUploadLink method. You can call that on the server, and then pass down the resulting link to the client, which can be used without the access token. It doesn’t support large files like upload sessions though, so that would only work for files less than 150 MB in size.

0reactions
greg-dbcommented, Jul 19, 2021

I see, thanks, that’s a helpful example. I’ve sent this along to the team.

Read more comments on GitHub >

github_iconTop Results From Across the Web

java - Unable to save the uploaded file into specific directory
I want to upload files and save them into specific directory.And i am new to files concept.When i uploading files from my page...
Read more >
file upload issue... — DataTables forums
I got the error message when file uploading with editor... Error : "The "path" argument must be one of type string, Buffer, or...
Read more >
StringBuffer (Java Platform SE 7 ) - Oracle Help Center
A thread-safe, mutable sequence of characters. A string buffer is like a String , but can be modified. At any point in time...
Read more >
Uploading objects - Amazon Simple Storage Service
When you upload a file to Amazon S3, it is stored as an S3 object. ... However, we recommend not changing the default...
Read more >
Reading files in Go — an overview - Kashyap Kondamudi
This should not be taken as a general advice when shipping production code, though. Reading byte-wise. Reading the entire file into memory. To ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found