Module for embedding information in text using zero-width characters
npm install zero-width-watermarkModule for embedding information in text using zero-width characters
NPM: https://www.npmjs.com/package/zero-width-watermark
Example Web App: https://zero-width-watermark-web.vercel.app/
``ts
import { embed, extract } from "zero-width-watermark";
// embed
const embeddedText = embed("sample", "hello worldπΎ");
console.log({ embeddedText });
// {
// embeddedText: "sββββββββββββββββββββββββaββββββββββββββββββββββββmββββββββββββββββββββββββpββββββββββββββββββββββββlββββββββββββββββββββββββe";
// }
// extractText
const extractText = extract(embeddedText);
console.log({ extractText });
// { extractText: 'hello worldπΎ' }
`
embed
`ts
const copyrightInfo = "
const blogText =
"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s";
const embeddedBlogText = embed(blogText, copyrightInfo, { repeat: 10 });
`
extract
`ts
const extraData = extract(
"Iββββββββββββββββββββββββpββββββββββββββββββββββββsββββββββββββββββββββββββuββββββββββββββββββββββββmββββββββββββββββββββββββ ββββββββββββββββββββββββiββββββββββββββββββββββββsββββββββββββββββββββββββ ββββββββββββββββββββββββsββββββββββββββββββββββββiββββββββββββββββββββββββmββββββββββββββββββββββββpββββββββββββββββββββββββlββββββββββββββββββββββββyββββββββββββββββββββββββ ββββββββββββββββββββββββdββββββββββββββββββββββββuββββββββββββββββββββββββmββββββββββββββββββββββββmββββββββββββββββββββββββyββββββββββββββββββββββββ ",
{
outputType: "string",
}
) as string;
// extraData: ga
const author = extraData.match(/
// author: @redshoga
``
MIT