gspeak 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +208 -0
- package/dist/bin/gspeak.d.ts +2 -0
- package/dist/bin/gspeak.js +38 -0
- package/dist/src/gSpeak.d.ts +17 -0
- package/dist/src/gSpeak.js +101 -0
- package/dist/src/gToken.d.ts +2 -0
- package/dist/src/gToken.js +49 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +11 -0
- package/dist/src/languages.d.ts +2 -0
- package/dist/src/languages.js +20 -0
- package/package.json +60 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 GlobalTechInfo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<img src="https://img.icons8.com/color/96/google-logo.png" alt="gspeak" width="96"/>
|
|
4
|
+
|
|
5
|
+
# gspeak
|
|
6
|
+
|
|
7
|
+
**Google Text to Speech for Node.js — modern, typed, zero deprecated dependencies.**
|
|
8
|
+
|
|
9
|
+
A TypeScript rewrite of [gtts](https://www.npmjs.com/package/gtts) — drop-in compatible.
|
|
10
|
+
|
|
11
|
+
[](https://github.com/GlobalTechInfo/gspeak/blob/main/LICENSE)
|
|
12
|
+
[](https://npmjs.com/package/gspeak)
|
|
13
|
+
[](https://www.codefactor.io/repository/github/GlobalTechInfo/gspeak)
|
|
14
|
+
[](https://npmjs.com/package/gspeak)
|
|
15
|
+
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## ✨ Features
|
|
21
|
+
|
|
22
|
+
- 🔊 Convert any text to speech using **Google TTS**
|
|
23
|
+
- 📦 **Zero deprecated dependencies**
|
|
24
|
+
- 🔷 Full **TypeScript** support
|
|
25
|
+
- 🔗 **Drop-in replacement** for `gtts`
|
|
26
|
+
- 🌍 **60+ languages** supported
|
|
27
|
+
- 💾 Save to file or stream directly
|
|
28
|
+
- 🖥️ **CLI** included
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## 📦 Installation
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm i gspeak
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## 🚀 Quick Start
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
import { gSpeak } from 'gspeak'
|
|
44
|
+
|
|
45
|
+
const tts = new gSpeak('Hello world', 'en')
|
|
46
|
+
tts.save('/tmp/hello.mp3', (err) => {
|
|
47
|
+
if (err) throw err
|
|
48
|
+
console.log('Saved to /tmp/hello.mp3')
|
|
49
|
+
})
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## 📥 Import
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
import { gSpeak } from 'gspeak' // ESM ✅
|
|
58
|
+
|
|
59
|
+
const { gSpeak } = require('gspeak') // CJS ✅
|
|
60
|
+
|
|
61
|
+
const gSpeak = require('gspeak').default // CJS ✅
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## 📖 Usage
|
|
67
|
+
|
|
68
|
+
### Save to file
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
import { gSpeak } from 'gspeak'
|
|
72
|
+
|
|
73
|
+
const tts = new gSpeak('Text to speak', 'en')
|
|
74
|
+
tts.save('/tmp/output.mp3', (err) => {
|
|
75
|
+
if (err) throw err
|
|
76
|
+
console.log('Done!')
|
|
77
|
+
})
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Stream (e.g. with Express)
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
import express from 'express'
|
|
84
|
+
import { gSpeak } from 'gspeak'
|
|
85
|
+
|
|
86
|
+
const app = express()
|
|
87
|
+
|
|
88
|
+
app.get('/speak', (req, res) => {
|
|
89
|
+
const tts = new gSpeak(req.query.text as string, req.query.lang as string)
|
|
90
|
+
tts.stream().pipe(res)
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
app.listen(3000, () => {
|
|
94
|
+
console.log('http://localhost:3000/speak?lang=en&text=Hello')
|
|
95
|
+
})
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Debug mode
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
const tts = new gSpeak('Hello', 'en', true) // 3rd param enables debug logging
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## 🖥️ CLI
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
npm install -g gspeak
|
|
110
|
+
gspeak "Hello Google Text to Speech" -l en -o /tmp/hello.mp3
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
| Flag | Alias | Description |
|
|
114
|
+
|------|-------|-------------|
|
|
115
|
+
| `--language` | `-l` | Language code (default: `en`) |
|
|
116
|
+
| `--output` | `-o` | Output file path (required) |
|
|
117
|
+
| `--verbose` | `-v` | Print debug messages |
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## 🌍 Supported Languages
|
|
122
|
+
|
|
123
|
+
| Code | Language |
|
|
124
|
+
|------|----------|
|
|
125
|
+
| `af` | Afrikaans |
|
|
126
|
+
| `sq` | Albanian |
|
|
127
|
+
| `ar` | Arabic |
|
|
128
|
+
| `hy` | Armenian |
|
|
129
|
+
| `ca` | Catalan |
|
|
130
|
+
| `zh` | Chinese |
|
|
131
|
+
| `zh-cn` | Chinese (Mandarin/China) |
|
|
132
|
+
| `zh-tw` | Chinese (Mandarin/Taiwan) |
|
|
133
|
+
| `zh-yue` | Chinese (Cantonese) |
|
|
134
|
+
| `hr` | Croatian |
|
|
135
|
+
| `cs` | Czech |
|
|
136
|
+
| `da` | Danish |
|
|
137
|
+
| `nl` | Dutch |
|
|
138
|
+
| `en` | English |
|
|
139
|
+
| `en-au` | English (Australia) |
|
|
140
|
+
| `en-uk` | English (United Kingdom) |
|
|
141
|
+
| `en-us` | English (United States) |
|
|
142
|
+
| `eo` | Esperanto |
|
|
143
|
+
| `fi` | Finnish |
|
|
144
|
+
| `fr` | French |
|
|
145
|
+
| `de` | German |
|
|
146
|
+
| `el` | Greek |
|
|
147
|
+
| `ht` | Haitian Creole |
|
|
148
|
+
| `hi` | Hindi |
|
|
149
|
+
| `hu` | Hungarian |
|
|
150
|
+
| `is` | Icelandic |
|
|
151
|
+
| `id` | Indonesian |
|
|
152
|
+
| `it` | Italian |
|
|
153
|
+
| `ja` | Japanese |
|
|
154
|
+
| `ko` | Korean |
|
|
155
|
+
| `la` | Latin |
|
|
156
|
+
| `lv` | Latvian |
|
|
157
|
+
| `mk` | Macedonian |
|
|
158
|
+
| `no` | Norwegian |
|
|
159
|
+
| `pl` | Polish |
|
|
160
|
+
| `pt` | Portuguese |
|
|
161
|
+
| `pt-br` | Portuguese (Brazil) |
|
|
162
|
+
| `ro` | Romanian |
|
|
163
|
+
| `ru` | Russian |
|
|
164
|
+
| `sr` | Serbian |
|
|
165
|
+
| `sk` | Slovak |
|
|
166
|
+
| `es` | Spanish |
|
|
167
|
+
| `es-es` | Spanish (Spain) |
|
|
168
|
+
| `es-us` | Spanish (United States) |
|
|
169
|
+
| `sw` | Swahili |
|
|
170
|
+
| `sv` | Swedish |
|
|
171
|
+
| `ta` | Tamil |
|
|
172
|
+
| `th` | Thai |
|
|
173
|
+
| `tr` | Turkish |
|
|
174
|
+
| `vi` | Vietnamese |
|
|
175
|
+
| `cy` | Welsh |
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## 🔄 Migrating from `gtts`
|
|
180
|
+
|
|
181
|
+
`gspeak` is a drop-in replacement. Just change the import:
|
|
182
|
+
|
|
183
|
+
```ts
|
|
184
|
+
// before
|
|
185
|
+
const gTTS = require('gtts')
|
|
186
|
+
const tts = new gTTS('Hello', 'en')
|
|
187
|
+
|
|
188
|
+
// after
|
|
189
|
+
const { gSpeak } = require('gspeak')
|
|
190
|
+
const tts = new gSpeak('Hello', 'en')
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Same constructor, same `.save()`, same `.stream()` — nothing else changes.
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## 📄 License
|
|
198
|
+
|
|
199
|
+
MIT © [Qasim Ali](https://github.com/GlobalTechInfo)
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
<div align="center">
|
|
204
|
+
|
|
205
|
+
Made with ❤️ — Thanks for using **gspeak**!
|
|
206
|
+
|
|
207
|
+
</div>
|
|
208
|
+
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const yargs_1 = __importDefault(require("yargs"));
|
|
8
|
+
const helpers_1 = require("yargs/helpers");
|
|
9
|
+
const gSpeak_1 = __importDefault(require("../src/gSpeak"));
|
|
10
|
+
const argv = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
|
|
11
|
+
.usage('Usage: $0 "text to speak" [options]')
|
|
12
|
+
.demandCommand(1, 'Please provide text to speak')
|
|
13
|
+
.option('l', {
|
|
14
|
+
alias: 'language',
|
|
15
|
+
default: 'en',
|
|
16
|
+
type: 'string',
|
|
17
|
+
describe: 'ISO 639-1 language code'
|
|
18
|
+
})
|
|
19
|
+
.option('o', {
|
|
20
|
+
alias: 'output',
|
|
21
|
+
demandOption: true,
|
|
22
|
+
type: 'string',
|
|
23
|
+
describe: 'Output file path'
|
|
24
|
+
})
|
|
25
|
+
.option('v', {
|
|
26
|
+
alias: 'verbose',
|
|
27
|
+
default: false,
|
|
28
|
+
type: 'boolean',
|
|
29
|
+
describe: 'Print debug messages'
|
|
30
|
+
})
|
|
31
|
+
.parseSync();
|
|
32
|
+
const gtts = new gSpeak_1.default(String(argv._[0]), argv.language, argv.verbose);
|
|
33
|
+
gtts.save(argv.output, (err) => {
|
|
34
|
+
if (err) {
|
|
35
|
+
process.stderr.write('Error: ' + err + '\n');
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PassThrough } from 'stream';
|
|
2
|
+
export type SaveCallback = (err: Error | null) => void;
|
|
3
|
+
export declare class gSpeak {
|
|
4
|
+
private lang;
|
|
5
|
+
private text;
|
|
6
|
+
private text_parts;
|
|
7
|
+
private debug;
|
|
8
|
+
constructor(text: string, lang?: string, debug?: boolean);
|
|
9
|
+
private getHeaders;
|
|
10
|
+
private getUrl;
|
|
11
|
+
stream(): PassThrough;
|
|
12
|
+
save(filePath: string, callback: SaveCallback): void;
|
|
13
|
+
private _tokenize;
|
|
14
|
+
private _minimize;
|
|
15
|
+
static get languages(): Record<string, string>;
|
|
16
|
+
}
|
|
17
|
+
export default gSpeak;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.gSpeak = void 0;
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const stream_1 = require("stream");
|
|
9
|
+
const gToken_1 = __importDefault(require("./gToken"));
|
|
10
|
+
const languages_1 = __importDefault(require("./languages"));
|
|
11
|
+
const GOOGLE_TTS_URL = 'https://translate.google.com/translate_tts';
|
|
12
|
+
const MAX_CHARS = 100;
|
|
13
|
+
const escapeRegExp = (s) => s.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&');
|
|
14
|
+
class gSpeak {
|
|
15
|
+
lang;
|
|
16
|
+
text;
|
|
17
|
+
text_parts;
|
|
18
|
+
debug;
|
|
19
|
+
constructor(text, lang = 'en', debug = false) {
|
|
20
|
+
this.debug = debug;
|
|
21
|
+
if (!languages_1.default[lang.toLowerCase()])
|
|
22
|
+
throw new Error(`Language not supported: ${lang}`);
|
|
23
|
+
this.lang = lang.toLowerCase();
|
|
24
|
+
if (!text)
|
|
25
|
+
throw new Error('No text to speak');
|
|
26
|
+
this.text = text;
|
|
27
|
+
let parts = text.length <= MAX_CHARS ? [text] : this._tokenize(text, MAX_CHARS);
|
|
28
|
+
parts = parts.map(p => p.replace(/\\n/g, '').trim()).filter(p => p.length > 0);
|
|
29
|
+
this.text_parts = parts;
|
|
30
|
+
}
|
|
31
|
+
getHeaders() {
|
|
32
|
+
return {
|
|
33
|
+
'Referer': 'http://translate.google.com/',
|
|
34
|
+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36'
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
getUrl(part, idx) {
|
|
38
|
+
const params = new URLSearchParams({
|
|
39
|
+
ie: 'UTF-8',
|
|
40
|
+
q: part,
|
|
41
|
+
tl: this.lang,
|
|
42
|
+
total: String(this.text_parts.length),
|
|
43
|
+
idx: String(idx),
|
|
44
|
+
client: 'tw-ob',
|
|
45
|
+
textlen: String(part.length),
|
|
46
|
+
tk: (0, gToken_1.default)(part)
|
|
47
|
+
});
|
|
48
|
+
return `${GOOGLE_TTS_URL}?${params}`;
|
|
49
|
+
}
|
|
50
|
+
stream() {
|
|
51
|
+
const pass = new stream_1.PassThrough();
|
|
52
|
+
(async () => {
|
|
53
|
+
for (const [idx, part] of this.text_parts.entries()) {
|
|
54
|
+
const url = this.getUrl(part, idx);
|
|
55
|
+
if (this.debug)
|
|
56
|
+
console.log({ part, idx, url });
|
|
57
|
+
const res = await fetch(url, { headers: this.getHeaders() });
|
|
58
|
+
if (!res.ok)
|
|
59
|
+
throw new Error(`Request failed: ${res.status}`);
|
|
60
|
+
pass.write(Buffer.from(await res.arrayBuffer()));
|
|
61
|
+
}
|
|
62
|
+
pass.end();
|
|
63
|
+
})().catch(err => pass.destroy(err));
|
|
64
|
+
return pass;
|
|
65
|
+
}
|
|
66
|
+
save(filePath, callback) {
|
|
67
|
+
;
|
|
68
|
+
(async () => {
|
|
69
|
+
for (const [idx, part] of this.text_parts.entries()) {
|
|
70
|
+
const url = this.getUrl(part, idx);
|
|
71
|
+
if (this.debug)
|
|
72
|
+
console.log({ part, idx, url });
|
|
73
|
+
const res = await fetch(url, { headers: this.getHeaders() });
|
|
74
|
+
if (!res.ok)
|
|
75
|
+
throw new Error(`Request failed: ${res.status}`);
|
|
76
|
+
await new Promise(async (resolve, reject) => {
|
|
77
|
+
const ws = (0, fs_1.createWriteStream)(filePath, { flags: idx > 0 ? 'a' : 'w' });
|
|
78
|
+
ws.on('finish', resolve);
|
|
79
|
+
ws.on('error', reject);
|
|
80
|
+
ws.end(Buffer.from(await res.arrayBuffer()));
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
})().then(() => callback(null)).catch(callback);
|
|
84
|
+
}
|
|
85
|
+
_tokenize(text, max_size) {
|
|
86
|
+
const punc = '¡!()[]¿?.,;:—«»\n'.split('').map(escapeRegExp);
|
|
87
|
+
const parts = text.split(new RegExp(punc.join('|')));
|
|
88
|
+
return parts.flatMap(p => this._minimize(p, ' ', max_size));
|
|
89
|
+
}
|
|
90
|
+
_minimize(str, delim, max_size) {
|
|
91
|
+
if (str.length <= max_size)
|
|
92
|
+
return [str];
|
|
93
|
+
const idx = str.lastIndexOf(delim);
|
|
94
|
+
return [str.substring(0, idx), ...this._minimize(str.substring(idx), delim, max_size)];
|
|
95
|
+
}
|
|
96
|
+
static get languages() {
|
|
97
|
+
return languages_1.default;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.gSpeak = gSpeak;
|
|
101
|
+
exports.default = gSpeak;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const SALT_1 = '+-a^+6';
|
|
4
|
+
const SALT_2 = '+-3^+b+-f';
|
|
5
|
+
function xr(a, b) {
|
|
6
|
+
for (let c = 0; c < b.length - 2; c += 3) {
|
|
7
|
+
const d = b.charAt(c + 2);
|
|
8
|
+
const dVal = d >= 'a' ? d.charCodeAt(0) - 87 : Number(d);
|
|
9
|
+
const shifted = b.charAt(c + 1) === '+' ? a >>> dVal : a << dVal;
|
|
10
|
+
a = b.charAt(c) === '+' ? (a + shifted) & 4294967295 : a ^ shifted;
|
|
11
|
+
}
|
|
12
|
+
return a;
|
|
13
|
+
}
|
|
14
|
+
function generateToken(text) {
|
|
15
|
+
const tokenKey = Math.floor(Date.now() / 3600);
|
|
16
|
+
const bytes = [];
|
|
17
|
+
let e = 0;
|
|
18
|
+
for (let f = 0; f < text.length; f++) {
|
|
19
|
+
let g = text.charCodeAt(f);
|
|
20
|
+
if (g < 128) {
|
|
21
|
+
bytes[e++] = g;
|
|
22
|
+
}
|
|
23
|
+
else if (g < 2048) {
|
|
24
|
+
bytes[e++] = (g >> 6) | 192;
|
|
25
|
+
}
|
|
26
|
+
else if ((g & 64512) === 55296 && f + 1 < text.length && (text.charCodeAt(f + 1) & 64512) === 56320) {
|
|
27
|
+
g = 65536 + ((g & 1023) << 10) + (text.charCodeAt(++f) & 1023);
|
|
28
|
+
bytes[e++] = (g >> 18) | 240;
|
|
29
|
+
bytes[e++] = ((g >> 12) & 63) | 128;
|
|
30
|
+
bytes[e++] = ((g >> 6) & 63) | 128;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
bytes[e++] = (g >> 12) | 224;
|
|
34
|
+
bytes[e++] = ((g >> 6) & 63) | 128;
|
|
35
|
+
}
|
|
36
|
+
bytes[e++] = (g & 63) | 128;
|
|
37
|
+
}
|
|
38
|
+
let a = tokenKey;
|
|
39
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
40
|
+
a += bytes[i];
|
|
41
|
+
a = xr(a, SALT_1);
|
|
42
|
+
}
|
|
43
|
+
a = xr(a, SALT_2);
|
|
44
|
+
if (a < 0)
|
|
45
|
+
a = (a & 2147483647) + 2147483648;
|
|
46
|
+
a %= 1e6;
|
|
47
|
+
return `${a}.${a ^ tokenKey}`;
|
|
48
|
+
}
|
|
49
|
+
exports.default = generateToken;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.LANGUAGES = exports.gSpeak = exports.default = void 0;
|
|
7
|
+
var gSpeak_1 = require("./gSpeak");
|
|
8
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return gSpeak_1.gSpeak; } });
|
|
9
|
+
Object.defineProperty(exports, "gSpeak", { enumerable: true, get: function () { return gSpeak_1.gSpeak; } });
|
|
10
|
+
var languages_1 = require("./languages");
|
|
11
|
+
Object.defineProperty(exports, "LANGUAGES", { enumerable: true, get: function () { return __importDefault(languages_1).default; } });
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const LANGUAGES = {
|
|
4
|
+
'af': 'Afrikaans', 'sq': 'Albanian', 'ar': 'Arabic', 'hy': 'Armenian',
|
|
5
|
+
'ca': 'Catalan', 'zh': 'Chinese', 'zh-cn': 'Chinese (Mandarin/China)',
|
|
6
|
+
'zh-tw': 'Chinese (Mandarin/Taiwan)', 'zh-yue': 'Chinese (Cantonese)',
|
|
7
|
+
'hr': 'Croatian', 'cs': 'Czech', 'da': 'Danish', 'nl': 'Dutch',
|
|
8
|
+
'en': 'English', 'en-au': 'English (Australia)', 'en-uk': 'English (United Kingdom)',
|
|
9
|
+
'en-us': 'English (United States)', 'eo': 'Esperanto', 'fi': 'Finnish',
|
|
10
|
+
'fr': 'French', 'de': 'German', 'el': 'Greek', 'ht': 'Haitian Creole',
|
|
11
|
+
'hi': 'Hindi', 'hu': 'Hungarian', 'is': 'Icelandic', 'id': 'Indonesian',
|
|
12
|
+
'it': 'Italian', 'ja': 'Japanese', 'ko': 'Korean', 'la': 'Latin',
|
|
13
|
+
'lv': 'Latvian', 'mk': 'Macedonian', 'no': 'Norwegian', 'pl': 'Polish',
|
|
14
|
+
'pt': 'Portuguese', 'pt-br': 'Portuguese (Brazil)', 'ro': 'Romanian',
|
|
15
|
+
'ru': 'Russian', 'sr': 'Serbian', 'sk': 'Slovak', 'es': 'Spanish',
|
|
16
|
+
'es-es': 'Spanish (Spain)', 'es-us': 'Spanish (United States)',
|
|
17
|
+
'sw': 'Swahili', 'sv': 'Swedish', 'ta': 'Tamil', 'th': 'Thai',
|
|
18
|
+
'tr': 'Turkish', 'vi': 'Vietnamese', 'cy': 'Welsh'
|
|
19
|
+
};
|
|
20
|
+
exports.default = LANGUAGES;
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "gspeak",
|
|
3
|
+
"version": "0.0.3",
|
|
4
|
+
"description": "Google Text to Speech — a modern TypeScript rewrite of gtts with zero deprecated dependencies",
|
|
5
|
+
"main": "dist/src/index.js",
|
|
6
|
+
"types": "dist/src/index.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"gspeak": "dist/bin/gspeak.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"prebuild": "rimraf dist",
|
|
15
|
+
"build": "tsc -p .",
|
|
16
|
+
"prepublishOnly": "npm run build",
|
|
17
|
+
"lint": "eslint src/**/*.ts bin/**/*.ts",
|
|
18
|
+
"test": "mocha --timeout 30000 -r ts-node/register \"tests/**/*.test.ts\""
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"google",
|
|
22
|
+
"tts",
|
|
23
|
+
"text-to-speech",
|
|
24
|
+
"gtts",
|
|
25
|
+
"gspeak",
|
|
26
|
+
"speech",
|
|
27
|
+
"audio",
|
|
28
|
+
"mp3",
|
|
29
|
+
"typescript"
|
|
30
|
+
],
|
|
31
|
+
"author": "Qasim Ali",
|
|
32
|
+
"license": "MIT",
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"yargs": "^18.0.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/mocha": "^10.0.0",
|
|
38
|
+
"@types/node": "^22.0.0",
|
|
39
|
+
"@types/yargs": "^17.0.0",
|
|
40
|
+
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
41
|
+
"@typescript-eslint/parser": "^8.0.0",
|
|
42
|
+
"eslint": "^9.0.0",
|
|
43
|
+
"mocha": "^11.0.0",
|
|
44
|
+
"rimraf": "^6.0.0",
|
|
45
|
+
"ts-node": "^10.9.2",
|
|
46
|
+
"typescript": "^5.0.0",
|
|
47
|
+
"typescript-eslint": "^8.0.0"
|
|
48
|
+
},
|
|
49
|
+
"publishConfig": {
|
|
50
|
+
"provenance": true
|
|
51
|
+
},
|
|
52
|
+
"repository": {
|
|
53
|
+
"type": "git",
|
|
54
|
+
"url": "git+https://github.com/GlobalTechInfo/gspeak.git"
|
|
55
|
+
},
|
|
56
|
+
"bugs": {
|
|
57
|
+
"url": "https://github.com/GlobalTechInfo/gspeak/issues"
|
|
58
|
+
},
|
|
59
|
+
"homepage": "https://github.com/GlobalTechInfo/gspeak#readme"
|
|
60
|
+
}
|