Skip to content

Latest commit

 

History

History
50 lines (35 loc) · 1012 Bytes

README.md

File metadata and controls

50 lines (35 loc) · 1012 Bytes

MorseCode.JS

Simple package to encode/decode morse code.

Installing

$ npm i @devsnowflake/morsecode.js

Example

Encoder

const morse = require("@devsnowflake/morsecode.js");
const message = "This is my message";

const mc = morse.Encode(message);
console.log(mc);
// - .... .. ... / .. ... / -- -.-- / -- . ... ... .- --. .

Decoder

const morse = require("@devsnowflake/morsecode.js");
const mc = "- .... .. ... / .. ... / -- -.-- / -- . ... ... .- --. .";

const message = morse.Decode(mc);
console.log(mc);
// this is my message

Audio Encoder

Note: Audio encoder is currently not accurate and might not work properly.

const morse = require("@devsnowflake/morsecode.js");
const fs = require("fs");
const message = "This is my message";

const mc = morse.Encode(message);
const audio = morse.CreateAudio(mc);

audio.pipe(fs.createWriteStream("./morse.mp3"));

Join my Discord