Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
littleninja
9 years agoExplorer | Level 3
Creating a syncing folder in the Dropbox Desktop folder with Node JS
I'm developing a desktop (electron) app that integrates with the Dropbox javascript SDK and uses node js to perform tasks on the local machine, allowing an online and offline experience. All I am...
littleninja
9 years agoExplorer | Level 3
I see what you're saying but I am acting purely on the local filesystem with Node js... the process has absolutely no connection to the dropbox API whatsoever... it is even done when there is not internet connection, so I'm really at a loss as to why a folder created in the local directory by node js differs to one created manually in the local directory... do you see what I'm saying?
Greg-DB
Dropbox Community Moderator
9 years agoI'm not sure I follow. You originally mentioned "the Dropbox JavaScript SDK", which I took to mean the official Dropbox JavaScript SDK:
https://github.com/dropbox/dropbox-sdk-js
That does use the Dropbox API. That wouldn't work without an Internet connection. Creating the folder manually on the local filsystem (not using the Dropbox SDK) would work without an Internet connection.
If something isn't working as expected, please share the relevant code/output.
- littleninja9 years agoExplorer | Level 3
Ok, this is what I've got...
An electron app that, when online, uses the official Dropbox Javascript SDK to read the files and folders from a Team folder on Dropbox.
Say you lose internet half way through use (this is unlikely I know, but the app has a separate mobile format that will be used primarily out and about in rural areas).... the app can no longer use the dropbox javascript sdk so it switches to reading from the local Dropbox Desktop folder using node js... no internet connection required.
So far so good... I've done all the above successfully without issue.
Now the final step is for the user, when online, to be able to choose which folders they want to be able to see nad browse in the offline version of the app (due to space issues on iPad and the sheer volume of data we're talking about, a default 'sync everything' through the dropbox Desktop app isn't an option). So the app displays the full folder and file structure using the dropbox JS SDK with an option for each to 'make available offline'. When this is selected for a file, no problem... I retrieve the file through the Dropbox JS SDK and write it to the appropriate folder (assuming it exists) in the local Dropbox Desktop folder, using node js. But the user can also choose a folder to make available offline. Currently I have successfully managed to go through the folder, getting all the folders and files it contains, int eh correct structure, using the Dropbox JS SDK, recreate the folders in the LOCAL Dropbox Desktop folder using Node js and writing the files in the way previously described... but here's the problem... These freshly created folders aren't set to sync by default. If I create a new folder manually in the local Dropbox Desktop folder, however, it does!
That's my issue. Why when a folder is created with Node js in the local directory does Dropbox Desktop not treat it exactly as if I'd created it manually?
I hope this makes it a little clearer? I really appreciate your willingness to understand my problem, I really do!!
- Greg-DB9 years ago
Dropbox Community Moderator
I see, thanks for clarifying. (Part of confusion is that the Dropbox JavaScript SDK can actually be used in Node JS in addition to in browser JavaScript, but it sounds like you're not actually referring to that.)
That is, you're actually referring to the difference between these two operations:
1) Creating a folder on the local filesystem by hand, i.e., using the local GUI.
2) Creating a folder on the local filesystem programmatically, using the Node JS filesystem interface (fs.mkdir, presumably).
I thought you were referring to using the API via the Dropbox JavaScript, given you reference to it in the first message, for use in the "online" case.
Unfortunately, since the "offline" operations you're referring to aren't about the API, I'm afraid I can't offer much help, as I only specialize in the Dropbox API (and this is the forum for the API in particular). We don't document/guarantee particular behaviors for the Dropbox desktop client for programmatic use like this.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!