Skip to content

CesiumLabs/morsecode.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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