dropbox-client
![npm package](https://img.shields.io/npm/v/dropbox-client.svg?style=flat-square)
dropbox-client is a client for the Dropbox developer API v2 that uses JavaScript's fetch API.
Installation
Using npm:
$ npm install --save dropbox-client
Then, use as you would anything else:
import { fetch, createFetch } from 'dropbox-client'
var fetch = require('dropbox-client').fetch
var createFetch = require('dropbox-client').createFetch
In node, dropbox-client automatically uses the node-fetch library under the hood so no extra configuration is necessary. You'll need to be running node >= 4. Be sure to read about the known differences between node-fetch and the fetch spec.
You'll need to shim window.fetch
in browsers that do not support it (Safari and IE). github/fetch is a great polyfill.
If you're bundling dropbox-client with webpack, you'll want to include the following in your webpack config:
const webpack = require('webpack')
module.exports = {
plugins: [
new webpack.IgnorePlugin(/node-fetch/),
new webpack.DefinePlugin({
'typeof window': JSON.stringify('object')
})
]
}
The UMD build is also available on npmcdn:
<script src="https://npmcdn.com/dropbox-client/umd/dropbox-client.min.js"></script>
You can find the library on window.DropboxClient
.