nodejs-whisper
Advanced tools
Comparing version 0.0.7 to 0.0.8
@@ -23,2 +23,3 @@ "use strict"; | ||
(0, utils_1.checkIfFileExists)(filePath); | ||
console.log(`[Nodejs-whisper] Transcribing file: ${filePath}\n`); | ||
yield (0, downloadModel_1.default)(); | ||
@@ -25,0 +26,0 @@ const outputFilePath = yield (0, utils_1.convertToWavType)(filePath); |
@@ -1,2 +0,2 @@ | ||
export declare const checkIfFileExists: (filePath: string) => void; | ||
export declare const checkIfFileExists: (filePath: string) => Promise<void>; | ||
export declare const convertToWavType: (inputFilePath: string) => Promise<string>; |
@@ -19,10 +19,9 @@ "use strict"; | ||
const shelljs_1 = __importDefault(require("shelljs")); | ||
const checkIfFileExists = (filePath) => { | ||
fs_1.default.access(filePath, fs_1.default.constants.F_OK, err => { | ||
if (err) { | ||
console.error(`[Nodejs-whisper] Error: No such file or directory: ${filePath}\n`); | ||
process.exit(1); | ||
} | ||
}); | ||
}; | ||
const checkIfFileExists = (filePath) => __awaiter(void 0, void 0, void 0, function* () { | ||
const isExist = fs_1.default.existsSync(filePath); | ||
if (!isExist) { | ||
console.error(`[Nodejs-whisper] Error: No such file : ${filePath}\n`); | ||
process.exit(1); | ||
} | ||
}); | ||
exports.checkIfFileExists = checkIfFileExists; | ||
@@ -33,5 +32,5 @@ const convertToWavType = (inputFilePath) => __awaiter(void 0, void 0, void 0, function* () { | ||
if (fileExtension !== 'wav') { | ||
console.warn('[Nodejs-whisper] Warning: Unsupported audio format.'); | ||
console.warn('[Nodejs-whisper] Warning: Unsupported audio format.\n'); | ||
console.log('[Nodejs-whisper] Converting audio to wav File Type...\n'); | ||
const command = `ffmpeg -i ${inputFilePath} -ar 16000 -ac 1 -c:a pcm_s16le ${outputFilePath}.wav`; | ||
const command = `ffmpeg -nostats -loglevel 0 -i ${inputFilePath} -ar 16000 -ac 1 -c:a pcm_s16le ${outputFilePath}.wav`; | ||
shelljs_1.default.exec(command); | ||
@@ -38,0 +37,0 @@ return `${outputFilePath}.wav`; |
@@ -15,2 +15,8 @@ "use strict"; | ||
} | ||
const isValidModelName = constants_1.MODELS_LIST.findIndex(model => model == args.modelName); | ||
if (isValidModelName == -1) { | ||
console.log('[Nodejs-whisper] Error: Enter a valid model name'); | ||
console.log('[Nodejs-whisper] Available models are:\n', constants_1.MODELS_LIST); | ||
process.exit(1); | ||
} | ||
let anyModelExist = []; | ||
@@ -17,0 +23,0 @@ constants_1.MODELS.forEach(model => { |
{ | ||
"name": "nodejs-whisper", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "Node bindings for OpenAI's Whisper. Optimized for CPU.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
3841840
4038