0.5.1 • Published 3 years ago

adonis-datadrive v0.5.1

Weekly downloads
17
License
MIT
Repository
github
Last release
3 years ago

Adonis DataDrive

Extended drive provider for AdonisJS 5.

NPM version build status npm download

:warning: This module is unstable and in active development. Use at your own risk.

Installation

npm i adonis-datadrive
node ace configure adonis-datadrive

Usage

import DataDrive from '@ioc:Zakodium/DataDrive';

const drive = DataDrive.use('myDrive');

// drive.put('myfile.txt', 'mycontent').then(...);

Examples

Upload file

import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext';

// Library importation
import DataDrive from '@ioc:Zakodium/DataDrive';

export default class FilesController {
  public async upload({ request, params }: HttpContextContract) {
    const { filename } = params;
    request.multipart.onFile(filename, {}, async (file) => {
      // Saves the file
      await DataDrive.use('dir').put(filename, file);
    });
    await request.multipart.process();
    return `${filename} uploaded`;
  }
}

License

MIT

0.5.1

3 years ago

0.5.0

3 years ago

0.4.0

3 years ago

0.3.0

3 years ago

0.2.0

3 years ago

0.1.4

3 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago