1.0.1 • Published 2 years ago

@draft-flysystem-ts/drop-box-adapter v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

@draft-flysystem-ts/drop-box-adapter

this project is not completed yet

Description:

This adapter allows you to work with DropBox. Under the hood it use official DropBox SDK for node.js. It works in composite with main FileSystem class. Also you may find useful codebase in @draft-flysystem-ts/general module.

Specifics of this adapter:

Be careful. This adapter does not support "visibility" property and related to it methods. This is due to the characteristics of the DropBox storage. Exception will be thrown. Also, since the official SDK does not work with streams, such methods as ".readStream()", ".writeStream()" also does not supported. But these methods will be support in the future. Follow the updates of this repository.

Usage

Import and construct example:

import { Filesystem } from '@draft-flysystem-ts/flysystem';
import { DropboxAdapter } from '@draft-flysystem-ts/drop-box-adapter;
import { join } from 'path'
import 'dotenv/config';


async function example() {
    const dropBoxAdapter = new DropboxAdapter({ accessToken: process.env.DBX_ACCESS });
    const flysystem = new Filesystem(dropBoxAdapter);
}

Upload example:

import fs from 'fs';

async function upload(flysystem: Filesystem<DropboxAdapter>) {
    const pathToFile = join(__dirname, 'relative/path/to/your/file.mp4');

    await flysystem.write('your/drop-box/file.mp4', fs.readFileSync(pathToFile));
}

Move (or rename) example:

async function move(flysystem: Filesystem<DropboxAdapter>) {
    await flysystem.move('your-dropbox/old-folder/file.mp4', 'your-dropbox/new-folder/file.mp4');
}

Copy example:

async function move(flysystem: Filesystem<DropboxAdapter>) {
    await flysystem.copy('your-dropbox/origin-file.mp4', 'your-dropbox/copy-file.mp4');
}
1.0.1

2 years ago

1.0.0

2 years ago

0.3.1

2 years ago

0.3.0

2 years ago

0.2.14

2 years ago

0.2.13

2 years ago

0.2.12

2 years ago

0.2.11

2 years ago

0.2.9

2 years ago

0.2.8

2 years ago

0.2.7

2 years ago

0.2.6

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago