npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@thezelijah/majik-blob

v1.0.3

Published

Majik Blob is a lightweight TypeScript/JavaScript library for securely encrypting and decrypting files (Blobs). Ideal for obfuscating files before storing or transmitting, preserving file type and extension, and preventing unauthorized access.

Downloads

22

Readme

Majik Blob

Majik Blob is a lightweight JavaScript/TypeScript library for encrypting and decrypting files (Blobs) securely.
It’s ideal for scenarios where you want to store files in cloud storage or deliver files but prevent direct access or downloads without the correct key.


Live Demo

Majik Blob Thumbnail

Click the image to try Majik Blob.


✨ Features

  • 🔐 Encrypt any file type (images, audio, video, 3D models, documents, etc.)
  • 📦 Returns a single encrypted Blob (.mjkb) with metadata for integrity verification
  • 🧾 Preserves original MIME type & file extension
  • 🧪 Tamper detection and password verification
  • ⚡ Fully reversible with the correct key and RQX
  • 💨 Optional compression to reduce file size before encryption
  • 🌐 Browser-first, TypeScript-friendly

Full API Docs


📦 Installation

npm i @thezelijah/majik-blob

Usage

Generate a Key

Encrypts the file and returns a .mjkb Blob. Majik Blob uses a password and an internal RQX key for encryption. Generate a key securely before encrypting:

import { MajikBlob } from "@thezelijah/majik-blob";
const { key, rqx } = MajikBlob.generateKey(32); // 32-character password

Encrypting Files

Optionally compress files before encryption to reduce size:

import { MajikBlob } from "@thezelijah/majik-blob";
import { downloadBlob } from "@thezelijah/majik-blob/utils";

const file = new File(["Hello world"], "example.txt", { type: "text/plain" });

const majik = new MajikBlob(key, file);
const encryptedBlob = await majik.getEncryptedBlob(rqx, true); // true enables compression

// Save or upload the encrypted file
downloadBlob(encryptedBlob, "mjkb", "example");

Decrypting Files

Decrypts a .mjkb Blob and restores the original file.

import { MajikBlob } from "@thezelijah/majik-blob";

const decrypted = await MajikBlob.decryptEncryptedBlob(encryptedBlob, key, rqx);

console.log(decrypted.data);       // Restored Blob
console.log(decrypted.type);       // Original MIME type
console.log(decrypted.extension);  // Original file extension

Reading File Extension Without Decryption

Reads the original file extension without decrypting the file.

const extension = await MajikBlob.getEncryptedFileExtension(encryptedBlob);
console.log(extension); // e.g. "glb", "mp3", "png"

Use Cases

  • Secure file uploads before storing in cloud storage
  • Obfuscated delivery of downloadable assets
  • Protecting media files (audio, video, 3D models)
  • Client-side encryption for creative tools
  • Controlled-access file distribution systems
  • DRM-adjacent workflows without heavy infrastructure

Best Practices

  • Use strong, unique passwords for each file.
  • Store un-hashed password/key in environment variables to prevent tampering.
  • Majik Blob is ideal for obfuscating files in storage; files cannot be opened without the correct key.
  • Always verify the key before decrypting to avoid corrupted files.
  • Compression is optional but recommended for large files.
  • AES-GCM ensures tamper detection and secure encryption.

Important: Always store the un-hashed encryption key and RQX in environment variables to prevent tampering and accidental exposure.

Contributing

Contributions, bug reports, and suggestions are welcome! Feel free to fork and open a pull request.


License

ISC — free for personal and commercial use.


Author

Made with 💙 by @thezelijah

About the Developer


Contact


What’s new in this version:

  1. Highlights AES-256-GCM encryption with random IVs (replaced Fernet).
  2. Mentions optional compression for smaller encrypted files.
  3. Clarifies integrity checks and tamper detection.
  4. Updated usage examples to include compression parameter.