dropbox files and folders crud
npm install @cloudcmd/dropbox[NPMIMGURL]: https://img.shields.io/npm/v/@cloudcmd/dropbox.svg?style=flat
[LicenseIMGURL]: https://img.shields.io/badge/license-MIT-317BF9.svg?style=flat
[NPMURL]: https://npmjs.org/package/@cloudcmd/dropbox "npm"
[BuildStatusURL]: https://github.com/cloudcmd/dropbox/actions?query=workflow%3A%22Node+CI%22 "Build Status"
[BuildStatusIMGURL]: https://github.com/cloudcmd/dropbox/workflows/Node%20CI/badge.svg
[LicenseURL]: https://tldrlegal.com/license/mit-license "MIT License"
[CoverageURL]: https://coveralls.io/github/cloudcmd/dropbox?branch=master
[CoverageIMGURL]: https://coveralls.io/repos/cloudcmd/dropbox/badge.svg?branch=master&service=github
Dropbox files and folders CRUD.
```
npm i @cloudcmd/dropbox --save
All functions requires token as first parameter
- token - stringstring
- path - object
- options - can contain:sort
- - sort by: name, size, dateorder
- - "asc" or "desc" for ascending and descending order (default: "asc")type
- - when "raw" returns not formatted result
#### Example
`js
const sort = 'size';
const order = 'desc';
const token = 'token';
const path = '/';
const type = 'raw';
const {readDir} = require('@cloudcmd/dropbox');
const files = await readDir(token, path, {
type,
sort,
order,
});
console.log(files);
// outputs
({
path: '/',
files: [{
name: 'dropbox.js',
size: 4735,
date: 1_377_248_899_000,
owner: 0,
mode: 0,
}, {
name: 'readify.js',
size: 3735,
date: 1_377_248_899_000,
owner: 0,
mode: 0,
}],
});
`
- token - token
- path - path to file
#### Example
`js
const {readFile} = require('@cloudcmd/dropbox');
const readStream = await readFile(token, '/dropbox.html');
readStream.pipe(process.stdout);
`
- token - token
- path - path to file
- contents - contents of a file
#### Example
`js
const {writeFile} = require('@cloudcmd/dropbox');
await writeFile(token, '/hello.txt', 'hello');
`
- token - token
- path - path to file
#### Example
`js
const {createReadStream} = require('fs');
const {createWriteStream} = require('@cloudcmd/dropbox');
const token = 'token';
const path = '/file';
const dropboxStream = createWriteStream(token, path);
const localStream = createReadStream(path);
localStream
.pipe(dropboxStream)
.on('error', console
.error)
.on('finish', console.log);
`
- token - token
- path - path to file
#### Example
`js
const {createWriteStream} = require('fs');
const {createReadStream} = require('@cloudcmd/dropbox');
const token = 'token';
const path = '/file';
const dropboxStream = createReadStream(path);
const localStream = createWriteStream(token, path);
dropboxStream
.pipe(localStream)
.on('error', console
.error)
.on('finish', console.log);
`
remove file/directory.
- token - token
- path - path to file
#### Example
`js
const {remove} = require('@cloudcmd/dropbox');
await remove(token, '/fileOrDir');
`
create directory.
- token - tokenstring
- path -
#### Example
`js
const {mkdir} = require('@cloudcmd/dropbox');
await mkdir(token, '/dirname');
`
Copy file/directory to new location
- token - tokenfrom
- from - path to
- to - path
#### Example
`js
const {copy} = require('@cloudcmd/dropbox');
await copy(token, '/file1', '/file2');
`
Move file/directory to new location
- token - tokenfrom
- from - path to
- to - path
#### Example
`js
const {move} = require('@cloudcmd/dropbox');
await move(token, '/file1', '/file2');
`
- readify - read directory content with file attributes: size, date, owner, mode
- flop - FoLder OPerations
- dropboxify - read directory content from dropbox compatible way with readify`
MIT