@pr0gramm/fluester
Advanced tools
Comparing version 0.3.10 to 0.3.12
@@ -7,3 +7,3 @@ /// <reference types="node" /> | ||
} | ||
export declare function execute(command: string, args?: readonly string[], shell?: boolean): Promise<ExecuteResult>; | ||
export declare function execute(command: string, args?: readonly string[], shell?: boolean, signal?: AbortSignal): Promise<ExecuteResult>; | ||
export declare function canExecute(file: string): Promise<boolean>; |
import { spawn } from "node:child_process"; | ||
import * as fs from "node:fs/promises"; | ||
export async function execute(command, args, shell = false) { | ||
export async function execute(command, args, shell = false, signal) { | ||
const child = spawn(command, args, { | ||
shell, | ||
signal, | ||
}); | ||
@@ -7,0 +8,0 @@ return new Promise((resolve, reject) => { |
@@ -22,2 +22,3 @@ import { ModelName } from "./model.js"; | ||
sourceLanguage?: string; | ||
signal?: AbortSignal; | ||
} | ||
@@ -24,0 +25,0 @@ export interface WhisperClient { |
@@ -35,3 +35,6 @@ import * as fs from "node:fs/promises"; | ||
// TODO: add return for continually updated progress value | ||
const transcript = await execute(effectiveOptions.executablePath, args); | ||
const transcript = await execute(effectiveOptions.executablePath, args, false, options.signal); | ||
if (options.signal?.aborted) { | ||
throw new Error("Operation aborted"); | ||
} | ||
// 3. parse whisper response string into array | ||
@@ -38,0 +41,0 @@ return transcriptToArray(transcript.stdout.toString()); |
{ | ||
"name": "@pr0gramm/fluester", | ||
"version": "0.3.10", | ||
"version": "0.3.12", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "Node.js bindings for OpenAI's Whisper. Optimized for CPU.", |
@@ -31,2 +31,8 @@ # fluester – [ˈflʏstɐ] [![CI](https://github.com/pr0gramm-com/fluester/actions/workflows/CI.yml/badge.svg)](https://github.com/pr0gramm-com/fluester/actions/workflows/CI.yml) [![CD](https://github.com/pr0gramm-com/fluester/actions/workflows/CD.yml/badge.svg)](https://github.com/pr0gramm-com/fluester/actions/workflows/CD.yml) ![version](https://img.shields.io/npm/v/%40pr0gramm/fluester) ![downloads](https://img.shields.io/npm/dm/%40pr0gramm/fluester) ![License](https://img.shields.io/npm/l/%40pr0gramm%2Ffluester) | ||
## Usage | ||
*Important*: The API only supports WAV files (just like the original whisper.cpp). You need to convert any files to a supported format before. | ||
You can do this using ffmpeg (example [taken from the whisper project](https://github.com/ggerganov/whisper.cpp)): | ||
```sh | ||
ffmpeg -i input.mp3 -ar 16000 -ac 1 -c:a pcm_s16le output.wav | ||
``` | ||
### Translation | ||
@@ -91,5 +97,4 @@ ```js | ||
``` | ||
This includes the model in the image. If you want to keep your image small, you can also download the model in your entrypoint using the commands above. | ||
This includes the model in the image. If you want to keep your image small, you can also download the model in your entrypoint using. | ||
## Made with | ||
@@ -96,0 +101,0 @@ - A lot of love by @ariym at [whisper-node](https://github.com/ariym/whisper-node) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5314579
4183
104