Dropbox Session Upload
About
Dropbox Session Upload provides a wrapper around the Dropbox Node Package. Session Uploading via the Dropbox
API is used for files that are large than 150mb. This section of the API can
be complicated and this package hopes to provide a clean wrapper around this
complicated API. This wrapper also supports concurrent file uploading out
of the box.
Requirements
Installation
npm install dropbox_session_upload
Usage
Upload Files Basic
This Example can be found in /examples/simple.js
const fs = require("fs")
const {upload} = require("dropbox_session_upload")
const files = [
{
file: fs.createReadStream("./datafile.txt"),
saveLocation: "/datafile1.txt"
},
{
file: fs.createReadStream("./datafile.txt"),
saveLocation: "/datafile2.txt"
},
{
file: fs.createReadStream("./datafile.txt"),
saveLocation: "/datafile3.txt"
}
]
upload(files, process.env.DROPBOXTOKEN, true )
.catch(error => console.log(error))
.then(() => console.log("Done Uploading!"))
Upload with Progress Tracking
This Example can be found in /examples/progressTracking.js
Adding progress tracking is simple, but due to the dropbox api progress will
only be updated every 8mb. This is the size of chunks this packages uploads
at once. So you will find that progress jumps in 8mb chunks. While annoying
it can still be helpful to know where your file is at in the upload process.
const fs = require("fs")
const { upload, progress } = require("dropbox_session_upload")
const files = [
{
file: fs.createReadStream("./datafile.txt"),
saveLocation: "/datafile1.txt",
id: "1"
},
{
file: fs.createReadStream("./datafile.txt"),
saveLocation: "/datafile1.txt",
id: "2"
},
{
file: fs.createReadStream("./datafile.txt"),
saveLocation: "/datafile1.txt",
id: "3"
}
]
upload(files, process.env.DROPBOXTOKEN)
.catch(error => console.log(error))
.then(() => console.log("Files Done!"))
progress(data => console.log(data))
Things to note when uploading
- This library will automatically strip out the following characters from
saveLocation
* | & ! @ # $ % ^ * ( ) [ ] { } | - _ = + < > ' " < >
to comply with dropbox file name requirements.