1.4.1 • Published 2 years ago

@flysystem-ts/drop-box-adapter v1.4.1

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

@flysystem-ts/drop-box-adapter

Home

Description:

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

Usage

Import and construct example:

import { Flysystem } from '@flysystem-ts/flysystem';
import { DBoxAdapter } from '@dflysystem-ts/drop-box-adapter';
import { join } from 'path'
import { readFileSync } from 'fs';
import 'dotenv/config';


async function example() {
    const dropBoxAdapter = new DBoxAdapter({ accessToken: process.env.DBX_ACCESS });
    const flysystem = Flysystem<DBoxAdapter>(dropBoxAdapter);
    
    const { id } = await flysystem.mkdirById({
        name: 'example'
    });
    const item = await flysystem.uploadById(readFileSync(join(__dirname, 'hi.txt')), {
        name: 'hi.txt',
        rootDirId: id,
    });
}

Upload example:

import fs from 'fs';

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

    await flysystem.uploadById(fs.readFileSync(pathToFile), {
        name: 'cool.mp4',
    });
}
1.4.1

2 years ago

1.4.0

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.3.0

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

0.2.0

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago