Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maskaravivek/e7b0cdd67bcf84380e41d7ed07254b0d to your computer and use it in GitHub Desktop.
Save maskaravivek/e7b0cdd67bcf84380e41d7ed07254b0d to your computer and use it in GitHub Desktop.
/*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