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 🙏

© 2024 – Pkg Stats / Ryan Hefner

monozip

v1.1.0

Published

Utility library that provides functionality to compress, encrypt, and decompress files using AES encryption

Downloads

7

Readme

Monozip 📦

Monozip is a utility library that provides functionality to compress, encrypt, and decompress files using AES encryption 🔐.

With a simple API, you can easily zip and encrypt a directory and later unzip and decrypt it.

Features 🚀

  • Generate encryption keys 🔑
  • Encrypt and zip folders 📁➡️🔒📦
  • Unzip and decrypt zipped files 📦🔓➡️📂

CLI Usage 💻

Monozip can be used directly from the command line. The general structure of a command is:

monozip [command] [options]

Installation 💾

To use the cli, install globally with npm:

npm install -g monozip

Usage 📖

To encrypt and zip a folder:

You can specify an encryption key and an output path using the -k and --output options respectively. If not specified, a key will be generated automatically, and the output file will be saved in the current directory.

monozip encrypt ./path/to/folder

After running this command, it will print out the encryption key used (keep it safe, you will need it to decrypt 🔐), and the path to the zipped file.

To unzip and decrypt a file:

You need to provide the encryption key and the path to the zipped file. You can also specify an output path using the -o option. If not specified, the file will be unzipped in the current directory.

monozip decrypt your-key ./path/to/file.zip

After running this command, it will print out the path to the unzipped and decrypted files.

Programmatic Usage 💡

Installation 💾

Install the library using npm:

npm install monozip

Encryption and Compression 🔐📦

To encrypt and zip a folder, you can use the generateKey and encryptAndZipFolder functions. Here is an example:

import { generateKey, encryptAndZipFolder } from "monozip";

const folderPath = "downloads/myphotos";

// Generate a new encryption key
const secretKey = generateKey();

// Encrypt and zip the folder
await encryptAndZipFolder(secretKey, fixtureFolderPath);

console.info(`Encrypted with key ${secretKey} and zipped folder ${folderPath}`);
// Encrypted with key e96c9074fa... and zipped folder downloads/myphotos.zip. Keep the key safe!

Decompression and Decryption 📂🔓

To unzip and decrypt a previously encrypted and zipped file, you can use the unzipAndDecryptZip function. Here is an example:

import { generateKey, unzipAndDecryptZip } from "monozip";

// Assume the encryption key is known
const secretKey = "my-secret-key";

// Unzip and decrypt the zipped file
const zipPath = "downloads/myphotos.zip";
const outputPath = await unzipAndDecryptZip(secretKey, zipPath, {
  outputPath: "downloads/myphotos-decrypted",
});

console.info(`Unzipped and decrypted ${outputPath}`);
// Unzipped and decrypted downloads/myphotos-decrypted

Testing 🧪

The project uses Vitest for testing.

You can run the tests with:

npm test

Contributing 🤝

We welcome contributions! Please see here for details on how to contribute.

License 📄

This project is open source, licensed under the MIT License. See LICENSE for details.