
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
morse-coder
Advanced tools
Lightweight Morse code encoding, decoding, and audio tooling for Node.js and modern bundlers. Convert plain text to Morse, parse Morse back to text, and generate WAV audio for playback or distribution.
Project homepage: https://morse-coder.com
Source repository: https://github.com/cabbagehao/cabbagehao
play-sound helperplay-sound (afplay, mpg123, mplayer, etc.) if you intend to call play()npm install morse-coder
or with pnpm / yarn:
pnpm add morse-coder
yarn add morse-coder
import { encode, decode, audio } from 'morse-coder';
const encoded = encode('SOS'); // ... --- ...
const decoded = decode('... --- ...'); // SOS
const player = audio('HELLO WORLD');
await player.play(); // start playback (requires external player)
await player.save('hello.wav'); // export to WAV
import { encode } from 'morse-coder';
const morse = encode('Hello, world!', {
letterSeparator: ' ', // default: single space
wordSeparator: ' ', // default: ' / '
unknownFallback: '?' // default: throws on unknown characters
});
letterSeparator: inserted between encoded letters.wordSeparator: inserted between encoded words.unknownFallback: string used when an input character is not in the Morse table. If omitted, encode will throw an error.import { decode } from 'morse-coder';
const text = decode('.... . .-.. .-.. --- / .-- --- .-. .-.. -..', {
letterSeparator: /\s+/, // supports string, RegExp, or string[]
wordSeparator: ['/', ' '], // handle both slash and triple spaces
unknownFallback: '�' // fallback character on unknown codes
});
letterSeparator: splitter used to group Morse tokens into letters.wordSeparator: splitter used to group tokens into words.unknownFallback: returned when a code has no matching character; omitted to throw an error instead.import { characters } from 'morse-coder';
const { letters, digits, punctuation } = characters();
console.log(letters.A); // .-
characters() returns shallow copies so you can inspect or extend them without mutating internal state.
import { audio } from 'morse-coder';
const morseAudio = audio('CQ CQ', {
inputType: 'text', // 'text' | 'morse' | 'auto' (default)
wpm: 18,
frequency: 700,
sampleRate: 44100,
volume: 0.6
});
await morseAudio.save('cq.wav'); // write to disk
await morseAudio.play(); // play through system default player
morseAudio.stop(); // stop playback early (no resume)
const buffer = morseAudio.toBuffer(); // obtain the WAV buffer for custom handling
When inputType is set to auto, the helper will detect whether the input looks like raw Morse (containing .-/) and choose the appropriate translation path automatically.
play()relies onplay-sound, which shells out to an installed player such asafplay(macOS) ormplayer(Linux/Windows). Install one of the supported players if playback fails.
The package ships with TypeScript declarations. If you need to reference the types directly:
import type { EncodeOptions, DecodeOptions, MorseAudioOptions } from 'morse-coder';
No additional configuration is required in a standard TS + ES2020 project.
npm run build
Outputs compiled ESM modules and .d.ts files into the dist directory. Bundlers such as Vite, webpack, and esbuild can consume the published package without additional steps.
FAQs
Lightweight Morse code encoder, decoder, and audio toolkit
The npm package morse-coder receives a total of 7 weekly downloads. As such, morse-coder popularity was classified as not popular.
We found that morse-coder 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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.