@idsync/dropbox-client
v0.0.2
Published
Dropbox client library
Downloads
4
Readme
Dropbox Client
Dropbox client library for Idsync
Installation
Simply run npm install @idsync/dropbox-client --save
to install.
Usage
Use the createClient
method to create a client interface:
const { createClient } = require("@idsync/dropbox-client");
const client = createClient("my-token");
You can then use the client
adapter to make requests like for directory contents:
client
.getDirectoryContents("/Documents")
.then(contents => {
// [ {
// name: "My directory",
// path: "/Documents/My directory",
// type: "directory"
// }, {
// name: "results.pdf",
// path: "/Documents/results.pdf",
// type: "file"
// } ]
});
You can also read and write files using getFileContents
and putFileContents
, respectively. Check out the API documentation for more information.
Fs
An fs
-like interface is also available:
const { createClient, createFsInterface } = require("@idsync/dropbox-client");
const client = createClient("my-token");
const dfs = createFsInterface(client);
dfs.readdir("/photos", (err, items) => {
// array of file names
});
Read the fs API documentation for more information on the available methods.