Skip to main content

Drive

The drive helper allows to easily manage the file system

Usage

src/controllers/user.controller.ts
import { Drive } from '@kult/core';

@KultController('/users')
class UserController extends ControllerBase {
constructor(app: Application) {
super(app);
}

@Post('/create')
async create() {
await Drive.write('/public/user.txt', 'some text');
return 'User created.';
}
}

export default UserController;

Reading files

Drive.read('/public/user.txt')

Writing files

Drive.write('/public/user.txt', 'some text')

Removing files

Drive.remove('/public/user.txt')