chimpers
v1.0.5
Published
hide files in text
Downloads
12
Maintainers
Readme
chimpers
A nodejs library that Hide files / zip / images in text by hidden format.
Web Demo | chimpers npm | chimpers-web npm | Github
Install
npm i chimpers
yarn add chimpers
Notices
- Hidden file is not encrypted currently.
- Do not attempt to hide large size file.
- Single file that smaller than 4kb is recommended.
Usage
import { addFileInText, decodeFile } from "chimpers"
import path from "path";
( async () => {
const filePath = path.join(__dirname, "yo.zip")
// Add files to text
const text = addFileInText(
"hello mate I am peter.", // Text to add files
filePath, // Your txt / zip / file ... locations
{ copyToBoard: false } // Optional: Will regarding text copy to your clipboard
);
// Decode regarding text
await decodeFile(
text, // Encoded text string
"hello", // Output file name
__dirname // Output file path
);
})()
Utilis
// Hide files in text
function addFileInText(
text: string,
file_path: string,
option?: AddFileInTextOptions
): string
interface AddFileInTextOptions{
copyToBoard?: boolean
}
// Decode hidden text and output a file
async function decodeFile(
encodedText: string,
outputFileName: string = "decodedFile",
outputPath: string = process.cwd()
): Promise<Uint8Array>
Web script
<script src="https://cdn.jsdelivr.net/gh/r48n34/chimpers/webOutput/chimpers.min.js"></script>
// only these two functions is provided in web script
// decode whole encoded string and extract the hidden file Uint8Array
champers.stringDataToBuffer(encodedText: string): Uint8Array
// encode a file to hidden string array
champers.encodeFile(data: Buffer): string[]
Check here to see how to use in web environment.
Roadmap
- [ ] Encrypt passowrd options
- [ ] Better compress size
- [ ] Web npm packages