# dropbox-stream

> Upload & Download streams for Dropbox

Latest version **3.2.0** (published 2020-03-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install dropbox-stream
pnpm add dropbox-stream
yarn add dropbox-stream
bun add dropbox-stream
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.2.0 |
| Published | 2020-03-14 |
| First published | 2016-12-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 15.7 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 36 |
| Author | Alexey Novikov |
| Maintainers | velocityzen |
| Keywords | dropbox, api, stream, upload, download, large, file, big |

## Links

- npm: https://www.npmjs.com/package/dropbox-stream
- Repository: https://github.com/velocityzen/dropbox-stream
- Homepage: https://github.com/velocityzen/dropbox-stream#readme
- Issues: https://github.com/velocityzen/dropbox-stream/issues
- npm.io page: https://npm.io/package/dropbox-stream

## Dependencies (1)

- [got](https://npm.io/package/got.md) ^10.6.0

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 3.2.0 (latest) — 2020-03-14
- 3.1.1 — 2019-07-11
- 3.1.0 — 2019-06-14
- 3.0.0 — 2018-11-12
- 2.1.0 — 2018-11-02
- 2.0.1 — 2018-11-01
- 2.0.0 — 2017-12-27
- 1.1.1 — 2017-12-27
- 1.1.0 — 2017-12-26
- 1.0.5 — 2017-06-07
- 1.0.4 — 2017-05-22
- 1.0.3 — 2016-12-29
- 1.0.2 — 2016-12-23
- 1.0.1 — 2016-12-23
- 1.0.0 — 2016-12-22

## README

# Dropbox Stream

[![NPM Version](https://img.shields.io/npm/v/dropbox-stream.svg?style=flat-square)](https://www.npmjs.com/package/dropbox-stream)
[![NPM Downloads](https://img.shields.io/npm/dt/dropbox-stream.svg?style=flat-square)](https://www.npmjs.com/package/dropbox-stream)

Upload & Download streams for [Dropbox](https://dropbox.com)

## Install

`npm i dropbox-stream`

## Usage

### Upload

Uploads stream to dropbox using upload session API

Events order:

  1. `progress`
  2. `metadata`


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

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

const up = db.createDropboxUploadStream({
    token: TOKEN,
    path: '/test/' + path.basename(FILETOUPLOAD),
    chunkSize: 1000 * 1024,
    autorename: true,
    mode: 'add'
  })
  .on('error', err => console.log(err))
  .on('progress', res => console.log(res))
  .on('metadata', metadata => console.log('Metadata', metadata))

fs.createReadStream(FILETOUPLOAD).pipe(up)
  .on('finish', () => console.log('This fires before metadata!'))

```

### Download

Downloads to stream from dropbox.

Events order:

  1. `metadata`
  2. `progress`


```js
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,
    path: FILETODOWNLOAD
  })
  .on('error', err => console.log(err))
  .on('metadata', metadata => console.log('Metadata', metadata))
  .on('progress', res => console.log(res))
  .pipe(fs.createWriteStream(FILETODOWNLOADTO))
  .on('finish', () => console.log('Done!'));

```

If you want to download a file from shared link use:

```js
db.createDropboxDownloadStream({
  token: TOKEN,
  url: 'sharedlink',
  path: 'optional file path if shared link is for a folder'
})
```

License MIT

---
_Source: https://npm.io/package/dropbox-stream · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
