Created
July 25, 2023 01:29
-
-
Save maskaravivek/e7b0cdd67bcf84380e41d7ed07254b0d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*global require, module, console */ | |
var path = require("path"), | |
fs = require("fs"), | |
os = require("os"), | |
uuid = require("uuid"), | |
s3 = require("./s3-util"); | |
var synthesizeText = require("./synthesize-text"); | |
const { env } = require("process"); | |
const BUCKET_NAME = env.BUCKET_NAME; | |
module.exports = function convert(inputObjectKey, outputObjectKey) { | |
"use strict"; | |
var sourcePath; | |
return s3 | |
.download(BUCKET_NAME, inputObjectKey) | |
.then(function (downloadedPath) { | |
sourcePath = downloadedPath; | |
return synthesizeText.synthesize(sourcePath); | |
}) | |
.then(async function (audioBuffers) { | |
await s3.upload(BUCKET_NAME, outputObjectKey, audioBuffers); | |
}) | |
.then(function () { | |
fs.unlinkSync(sourcePath); | |
return outputObjectKey; | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment