npm

Need private packages and team management tools?Check out npm Orgs. »

readbox

2.2.0 • Public • Published

Readbox License NPM version Dependency Status Build Status Coverage Status

Read file or directory from dropbox.

Install

npm i readbox

API

readbox requires token as first parameter

readbox(token, path[, options], fn)

  • token - string
  • path - string
  • options - object can contain:
    • sort - sort by: name, size, date
    • order - "asc" or "desc" for ascending and descending order (default: "asc")
    • type - when "raw" returns not formatted result
    • root - root directory to cut from result
  • fn - function callback

Example

const sort = 'size';
const order = 'desc';
const token = 'token';
const path = '/';
const type = 'raw';
 
const readbox = require('readbox');
 
const stream = await readbox(token, path, {type, sort, order})
console.log(stream.type);
// outputs
'directory'
 
stream.pipe(process.stdout)
// outputs
{
    path: "/",
    files: [{
        name: 'readbox.js',
        size: 4735,
        date: 1377248899000,
        owner: 0,
        mode: 0
    }, {
        name: 'readify.js',
        size: 3735,
        date: 1377248899000,
        owner: 0,
        mode: 0
    }];
}
 
const stream = await readbox(token, '/dropbox.html');
console.log(stream.type);
// outputs
'file'
 
stream.pipe(process.stdout);

Related

  • readify - read directory content with file attributes: size, date, owner, mode
  • flop - FoLder OPerations
  • dropboxify - read directory content from readbox compatible way with readify
  • dropbox - Dropbox files and folders CRUD

License

MIT

install

npm i readbox

Downloadsweekly downloads

390

version

2.2.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability