conditional mp3 conversion..

This commit is contained in:
Dooho Yi 2022-01-14 12:57:51 +09:00
parent 8a5cb7afa8
commit 8cfa769f5f

View file

@ -76,7 +76,9 @@ fastify.post("/entry", async function (request, reply) {
let tmpdir = path.dirname(audiofile.filepath); let tmpdir = path.dirname(audiofile.filepath);
// console.log(audiofile.fields.message.value); // console.log(audiofile.fields.message.value);
//convert to mp3 //convert to mp3 ?
if (path.extname(audiofile.filename) !== ".mp3") {
console.log("convert to mp3...");
function converter() { function converter() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// //
@ -97,6 +99,7 @@ fastify.post("/entry", async function (request, reply) {
} }
await converter(); await converter();
// console.log(await fs.readdir(tmpdir)); // console.log(await fs.readdir(tmpdir));
}
//upload //upload
const client = new Client(server); const client = new Client(server);