
Research
/Security News
Malicious npm Packages Target WhatsApp Developers with Remote Kill Switch
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
vue-transcribe
Advanced tools
A Vue.js directive and service for speech-to-text transcription using AWS Transcribe
A lightweight Vue 2 & Vue 3 compatible directive + service bundle for real-time Speech-to-Text via WebSocket — ideal for integrating AWS Transcribe WebSocket service into Vue apps.
generate
) or mapped voice commands (command
)TranscribeEmitter
) for handling errors externallynpm install vue-transcribe
Export | Description |
---|---|
TranscribeDirective | Vue directive for adding speech-to-text behavior to input containers |
TranscribeService | Singleton managing WebSocket and configuration |
CommandProcessor | Global processor for mapping voice commands to app-defined tasks |
TranscribeEmitter | Emitter that emits error events for custom handling in the host app |
import { TranscribeDirective } from 'vue-transcribe';
app.directive('transcribe', TranscribeDirective);
import Vue from 'vue';
import { TranscribeDirective } from 'vue-transcribe';
Vue.directive('transcribe', TranscribeDirective);
import 'vue-transcribe/css';
You must assign a valid presigned WebSocket URL before using the directive.
import axios from 'axios';
import { TranscribeService } from 'vue-transcribe';
function updateWebSocketURL() {
axios.get('/api/transcribe-url')
.then(res => TranscribeService.getInstance().setURL(res.data.url))
.catch(err => console.error('Failed to fetch URL:', err));
}
// Initial setup
updateWebSocketURL();
// Refresh every 5 minutes (AWS presigned URLs expire after 5 minutes)
setInterval(updateWebSocketURL, 5 * 60 * 1000);
Set TranscribeService.getInstance().configured = true
to activate the directive.
If using type: 'command'
, configure the CommandProcessor
globally:
import { CommandProcessor } from 'vue-transcribe';
CommandProcessor.commandMap = [
{
command: 'say hello',
task: () => alert('Hello!')
},
{
command: 'clear input',
task: () => {
const input = document.querySelector('#myInput');
if (input) input.value = '';
}
}
];
Use the TranscribeEmitter
to listen for errors:
import { TranscribeEmitter } from 'vue-transcribe';
TranscribeEmitter.on('error', (err) => {
console.error('Transcription error:', err);
// You could show a toast, log it, etc.
});
Wrap your input or textarea inside a container and apply v-transcribe
with options:
<div v-transcribe="directiveOptions">
<input type="text" id="myInput" />
</div>
const directiveOptions = {
style: {
mic: { backgroundColor: 'red' },
spinner: { color: 'blue' },
vector: { margin: '0 auto' },
container: { padding: '8px' }
},
languageCode: 'en-US',
type: 'generate',
maxRecordingTime: 5000,
append: true,
micIconClass: ['fa', 'fa-microphone'],
listeningSVG: 'https://cdn.com/listening.svg'
};
Option | Type | Description |
---|---|---|
style | Object | Style overrides for mic , spinner , vector , container |
languageCode | String | BCP-47 language code (e.g. en-US ) |
type | "generate" | "command" | generate inserts text; command matches and executes mapped commands |
maxRecordingTime | Number (ms) | Max allowed recording duration |
append | Boolean | If true , appends to input content; else, replaces |
micIconClass | Array<String> | CSS class names for mic icon button |
listeningSVG | String (URL) | Path to animation shown while listening |
Option | Default Value |
---|---|
type | 'generate' |
maxRecordingTime | 5000 |
append | false |
micIconClass | ['mdi', 'mdi-microphone'] |
listeningSVG | https://bposeats-downloads-test.s3.us-east-1.amazonaws.com/listening.svg |
style: {
mic: { backgroundColor: 'red', borderRadius: '50%' },
spinner: { color: 'blue' },
vector: { width: '20px', height: '20px' },
container: { padding: '10px', display: 'flex' }
}
Each sub-property is a style object applied to its respective control element and is optional.
Mode | Description |
---|---|
generate | Converts speech to freeform text, injected into the input |
command | Matches speech to a registered command and executes the mapped task (function) |
TranscribeService.getInstance().configured === true
CommandProcessor.commandMap
must be an array of { command, task }
TranscribeEmitter.on('error', cb)
to listen for transcription errorsimport Vue from 'vue';
import {
TranscribeDirective,
TranscribeService,
CommandProcessor,
TranscribeEmitter
} from 'vue-transcribe';
import axios from 'axios';
import 'vue-transcribe/css';
Vue.directive('transcribe', TranscribeDirective);
CommandProcessor.commandMap = [
{ command: 'hello', task: () => console.log('Hi!') }
];
function setURL() {
axios.get('/api/transcribe-url')
.then(res => TranscribeService.getInstance().setURL(res.data.url));
}
setURL();
setInterval(setURL, 5 * 60 * 1000);
TranscribeService.getInstance().configured = true;
TranscribeEmitter.on('error', err => {
console.error('Transcription error:', err);
});
ISC
Merge Requests welcome! Please follow existing code style and include docs for any new features or events.
Charles Ugbana
FAQs
An encapsulated Vue.js component + service for speech-to-text functionality using AWS Transcribe
We found that vue-transcribe demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
Research
/Security News
Socket uncovered 11 malicious Go packages using obfuscated loaders to fetch and execute second-stage payloads via C2 domains.
Security News
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.