conditional mp3 conversion..
This commit is contained in:
parent
8a5cb7afa8
commit
8cfa769f5f
1 changed files with 23 additions and 20 deletions
|
|
@ -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);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue