@andresaya/edge-tts 1.1.4 → 1.1.6

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.
@@ -1943,11 +1943,17 @@ class EdgeTTS {
1943
1943
  if (this.audio_stream.length) {
1944
1944
  const audioBuffer = Buffer.concat(this.audio_stream);
1945
1945
  const uint8Array = new Uint8Array(audioBuffer);
1946
- writeFileSync(outputPath, uint8Array);
1946
+ writeFileSync(`${outputPath}.${this.audio_format}`, uint8Array);
1947
1947
  } else {
1948
1948
  throw new Error("No audio data available to save.");
1949
1949
  }
1950
1950
  }
1951
+ async toRaw() {
1952
+ if (this.audio_stream.length === 0) {
1953
+ throw new Error("No audio data available.");
1954
+ }
1955
+ return Buffer.concat(this.audio_stream);
1956
+ }
1951
1957
  toBase64() {
1952
1958
  const audioBuffer = Buffer.concat(this.audio_stream);
1953
1959
  return audioBuffer.toString("base64");
@@ -1995,7 +2001,7 @@ var VoiceListCommand = new Command("voice-list").description("Get the list of av
1995
2001
 
1996
2002
  // src/cli/edge-tts.ts
1997
2003
  var program2 = new Command;
1998
- program2.version("1.1.2").addCommand(SynthesizeCommand).addCommand(VoiceListCommand);
2004
+ program2.version("1.1.4").addCommand(SynthesizeCommand).addCommand(VoiceListCommand);
1999
2005
  try {
2000
2006
  program2.parse();
2001
2007
  } catch (error) {
@@ -1943,11 +1943,17 @@ class EdgeTTS {
1943
1943
  if (this.audio_stream.length) {
1944
1944
  const audioBuffer = Buffer.concat(this.audio_stream);
1945
1945
  const uint8Array = new Uint8Array(audioBuffer);
1946
- writeFileSync(outputPath, uint8Array);
1946
+ writeFileSync(`${outputPath}.${this.audio_format}`, uint8Array);
1947
1947
  } else {
1948
1948
  throw new Error("No audio data available to save.");
1949
1949
  }
1950
1950
  }
1951
+ async toRaw() {
1952
+ if (this.audio_stream.length === 0) {
1953
+ throw new Error("No audio data available.");
1954
+ }
1955
+ return Buffer.concat(this.audio_stream);
1956
+ }
1951
1957
  toBase64() {
1952
1958
  const audioBuffer = Buffer.concat(this.audio_stream);
1953
1959
  return audioBuffer.toString("base64");
@@ -1943,11 +1943,17 @@ class EdgeTTS {
1943
1943
  if (this.audio_stream.length) {
1944
1944
  const audioBuffer = Buffer.concat(this.audio_stream);
1945
1945
  const uint8Array = new Uint8Array(audioBuffer);
1946
- writeFileSync(outputPath, uint8Array);
1946
+ writeFileSync(`${outputPath}.${this.audio_format}`, uint8Array);
1947
1947
  } else {
1948
1948
  throw new Error("No audio data available to save.");
1949
1949
  }
1950
1950
  }
1951
+ async toRaw() {
1952
+ if (this.audio_stream.length === 0) {
1953
+ throw new Error("No audio data available.");
1954
+ }
1955
+ return Buffer.concat(this.audio_stream);
1956
+ }
1951
1957
  toBase64() {
1952
1958
  const audioBuffer = Buffer.concat(this.audio_stream);
1953
1959
  return audioBuffer.toString("base64");
package/dist/index.js CHANGED
@@ -117,11 +117,17 @@ class EdgeTTS {
117
117
  if (this.audio_stream.length) {
118
118
  const audioBuffer = Buffer.concat(this.audio_stream);
119
119
  const uint8Array = new Uint8Array(audioBuffer);
120
- writeFileSync(outputPath, uint8Array);
120
+ writeFileSync(`${outputPath}.${this.audio_format}`, uint8Array);
121
121
  } else {
122
122
  throw new Error("No audio data available to save.");
123
123
  }
124
124
  }
125
+ async toRaw() {
126
+ if (this.audio_stream.length === 0) {
127
+ throw new Error("No audio data available.");
128
+ }
129
+ return Buffer.concat(this.audio_stream);
130
+ }
125
131
  toBase64() {
126
132
  const audioBuffer = Buffer.concat(this.audio_stream);
127
133
  return audioBuffer.toString("base64");
@@ -117,11 +117,17 @@ class EdgeTTS {
117
117
  if (this.audio_stream.length) {
118
118
  const audioBuffer = Buffer.concat(this.audio_stream);
119
119
  const uint8Array = new Uint8Array(audioBuffer);
120
- writeFileSync(outputPath, uint8Array);
120
+ writeFileSync(`${outputPath}.${this.audio_format}`, uint8Array);
121
121
  } else {
122
122
  throw new Error("No audio data available to save.");
123
123
  }
124
124
  }
125
+ async toRaw() {
126
+ if (this.audio_stream.length === 0) {
127
+ throw new Error("No audio data available.");
128
+ }
129
+ return Buffer.concat(this.audio_stream);
130
+ }
125
131
  toBase64() {
126
132
  const audioBuffer = Buffer.concat(this.audio_stream);
127
133
  return audioBuffer.toString("base64");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andresaya/edge-tts",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "module": "dist/index.js",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",