I am developing a nestjs application and i need to upload multimedia file in ftp server and stream it.
i can save and stream files in my local server but i want to store files in my ftp server.
i have already done this parts for upload:
@Controller('')
export class FileController{
@Post('upload')
@UseInterceptors(FileInterceptor('track', {
dest: './uploads/files',
storage: diskStorage({
destination: './uploads/files',
filename: (req, file, callback) => {
callback(null, uuidv4() + '.mp3')
}
})
}))
async createTrack(@UploadedFile() file: Express.Multer.File) {
return catchAsync(async () => {
return new AppException(file).getResponse()
})
}
}
and for stream:
@Controller('')
export class FileController{
@Get('file/:file_id')
@Header('Access-Control-Allow-Origin', '*')
async getStreamTracks(@Param('file_id') file_id: string) {
return catchAsync(async () => {
return await this.filesService.getStream(file_id)
})
}
}
now i want to modify this two parts to make me able to upload to ftp server and stream from ftp server.