https://github.com/zakodium/adonis-datadrive
Extended drive provider for AdonisJs
https://github.com/zakodium/adonis-datadrive
Last synced: 5 months ago
JSON representation
Extended drive provider for AdonisJs
- Host: GitHub
- URL: https://github.com/zakodium/adonis-datadrive
- Owner: zakodium
- License: mit
- Created: 2019-12-02T14:36:48.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2021-09-24T16:16:57.000Z (over 4 years ago)
- Last Synced: 2025-10-20T10:41:48.821Z (8 months ago)
- Language: TypeScript
- Homepage:
- Size: 53.7 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Adonis DataDrive
Extended drive provider for AdonisJS 5.
Maintained by Zakodium
[![NPM version][npm-image]][npm-url]
[![build status][ci-image]][ci-url]
[![npm download][download-image]][download-url]
| :warning: This module is unstable and in active development. Use at your own risk. |
| ---------------------------------------------------------------------------------- |
## Installation
```console
npm i adonis-datadrive
node ace configure adonis-datadrive
```
## Usage
```js
import DataDrive from '@ioc:Zakodium/DataDrive';
const drive = DataDrive.use('myDrive');
// drive.put('myfile.txt', 'mycontent').then(...);
```
## Examples
### Upload file
```js
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](./LICENSE)
[npm-image]: https://img.shields.io/npm/v/adonis-datadrive.svg
[npm-url]: https://www.npmjs.com/package/adonis-datadrive
[ci-image]: https://github.com/zakodium/adonis-datadrive/workflows/Node.js%20CI/badge.svg?branch=main
[ci-url]: https://github.com/zakodium/adonis-datadrive/actions?query=workflow%3A%22Node.js+CI%22
[download-image]: https://img.shields.io/npm/dm/adonis-datadrive.svg
[download-url]: https://www.npmjs.com/package/adonis-datadrive