First, you have to install it :
npm i steganodejs -g #it's better to install it globally
And then, you can do :
stegano encode <your image path> <your text> <your password> <?the new file path>
or
stegano decode <your image path> <your password> <?the .txt file of the content>
Note that you can't encode a text of more of 64.25 ko (for now)
If you want to do things in js, you can do :
(async () => {
const SuperCanvas = require('steganodejs'),
src = './Your_image.png', // string of relative or absolute path or buffer of image
text = 'Your text', // string of your text to encode
password = 'Your password', // string of your password, can be '' or littler then your text
encoded = await SuperCanvas.encode(src, text, password);
encoded.save('./Your_encoded_image.png');
})();
If you want to encode another thing that a text, you can do :
const superCanvas = new SuperCanvas('<your image to encode path of buffer>');
await superCanvas.load();
text = superCanvas.buff.toString(); // But not gretter than 64.25 ko