@idsync/dropbox-client

0.0.2 • Public • Published

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.

/@idsync/dropbox-client/

    Package Sidebar

    Install

    npm i @idsync/dropbox-client

    Weekly Downloads

    3

    Version

    0.0.2

    License

    MIT

    Unpacked Size

    33.2 kB

    Total Files

    13

    Last publish

    Collaborators

    • idsyncsa
    • idsync-npm