JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 515
  • Score
    100M100P100Q100076F
  • License MIT

Upload & Download streams for Dropbox

Package Exports

  • dropbox-stream

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (dropbox-stream) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Dropbox Stream

NPM Version NPM Downloads

Upload & Download streams for Dropbox

Install

npm i dropbox-stream

Usage

Upload

Uploading files to dropbox using upload session API

const db = require('dropbox-stream');

const TOKEN = 'put your dropbox token here';
const FILETOUPLOAD = '/some/file.txt';

let up = db.createDropboxUploadStream({
    token: TOKEN,
    filepath: '/test/' + path.basename(FILETOUPLOAD),
    chunkSize: 1000 * 1024,
    autorename: true
  })
  .on('done', res => console.log('Success', res))
  .on('progress', res => console.log(res))
  .on('error', err => console.log(err))

fs.createReadStream(FILETOUPLOAD).pipe(up);

Download

const db = require('dropbox-stream');

const TOKEN = 'put your dropbox token here';
const FILETODOWNLOAD = '/some/file.txt';
const FILETODOWNLOADTO = './file.txt';

db.createDropboxDownloadStream({
  token: TOKEN,
  filepath: FILETODOWNLOAD
})
.on('metadata', metadata => console.log('Metadata', metadata))
.on('error', err => console.log(err))
.pipe(fs.createWriteStream(FILETODOWNLOADTO));

License MIT