Back: Fix Musicxml route

This commit is contained in:
Arthur Jamet
2023-05-04 11:47:44 +01:00
parent 97be3b9c76
commit c3e8fb1c45

View File

@@ -20,7 +20,7 @@ import { CreateSongDto } from './dto/create-song.dto';
import { SongService } from './song.service';
import { Request } from 'express';
import { Prisma, Song } from '@prisma/client';
import { createReadStream } from 'fs';
import { createReadStream, lstat, promises } from 'fs';
import { ApiTags } from '@nestjs/swagger';
@Controller('song')
@@ -46,7 +46,7 @@ export class SongController {
const song = await this.songService.song({ id });
if (!song) throw new NotFoundException('Song not found');
const file = createReadStream(song.midiPath);
const file = createReadStream(song.musicXmlPath, { encoding: 'binary' });
return new StreamableFile(file);
}