UNPKG

1.56 kBTypeScriptView Raw
1interface Option {
2 lang?: string;
3 slow?: boolean;
4 host?: string;
5 timeout?: number;
6}
7/**
8 * Get "Google TTS" audio base64 text
9 *
10 * @param {string} text length should be less than 200 characters
11 * @param {object?} option
12 * @param {string?} option.lang default is "en"
13 * @param {boolean?} option.slow default is false
14 * @param {string?} option.host default is "https://translate.google.com"
15 * @param {number?} option.timeout default is 10000 (ms)
16 * @returns {Promise<string>} url
17 */
18export declare const getAudioBase64: (text: string, { lang, slow, host, timeout }?: Option) => Promise<string>;
19interface LongTextOption extends Option {
20 splitPunct?: string;
21}
22/**
23 * @typedef {object} Result
24 * @property {string} shortText
25 * @property {string} base64
26 */
27/**
28 * Split the long text into multiple short text and generate audio base64 list
29 *
30 * @param {string} text
31 * @param {object?} option
32 * @param {string?} option.lang default is "en"
33 * @param {boolean?} option.slow default is false
34 * @param {string?} option.host default is "https://translate.google.com"
35 * @param {string?} option.splitPunct split punctuation
36 * @param {number?} option.timeout default is 10000 (ms)
37 * @return {Result[]} the list with short text and audio base64
38 */
39export declare const getAllAudioBase64: (text: string, { lang, slow, host, splitPunct, timeout, }?: LongTextOption) => Promise<{
40 shortText: string;
41 base64: string;
42}[]>;
43export {};
44//# sourceMappingURL=getAudioBase64.d.ts.map
\No newline at end of file