Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nodejs-whisper

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nodejs-whisper - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

1

dist/index.js

@@ -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);

2

dist/utils.d.ts

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc