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

shifro

v1.2.4

Published

A lightweight library and command-line tool for decrypting MP4 files

Readme

shifro

A lightweight library for decrypting MP4 files, directly in the browser or via CLI on your machine.

This tool is a small wrapper around the Mediabunny library with slight API changes and command-line support.

Usage

CLI

Node.js is required (or any other runtime that has compatibility with Node.js API, like Bun).

Run npm install -g shifro to install the command-line tool globally.

shifro --key eb676abbcb345e96bbcf616630f1a3da:100b6c20940f779a4589152b57d2dacb ./input.mp4 ./output.mp4

You can also use npx shifro ... to run the CLI tool without installing it globally

This CLI can be used as an alternative to the mp4decrypt or shaka-packager.

Library

Run npm install shifro to install the library as dependency for your project.

Decrypting file using Node.js streams

import { Decryption, FilePathSource, FilePathTarget, Input, Output } from 'shifro';
import type { Key, KeyId } from 'shifro';

async function decrypt() {
  const decryption = await Decryption.init({
    input: new Input({
      source: new FilePathSource('./input.mp4'),
      keys: new Map<KeyId, Key>([
        ['4d97930a3d7b55fa81d0028653f5e499', '429ec76475e7a952d224d8ef867f12b6'],
        ['d21373c0b8ab5ba9954742bcdfb5f48b', '150a6c7d7dee6a91b74dccfce5b31928'],
      ]),
      // Optionally, you can use this callback to handle encryption information (like key ID and PSSH boxes)
      handleEncryptionInfo: ({ keyId, psshBoxes }) => {
        console.group(`Key ID: ${keyId}`);
        for (const psshBox of psshBoxes) {
          console.log(`PSSH box: ${psshBox.systemId} (${psshBox.data.length} bytes)`);
        }
        console.groupEnd();
      },
    }),
    output: new Output({ target: new FilePathTarget('./output.mp4') }),
  });

  decryption.onProgress = (progress) =>
    process.stdout.write(`\rDecrypting... [${Math.round(progress * 100)}%]`);

  await decryption.execute();
}

Decrypting file with an external AES backend

import {
  Decryption,
  FilePathSource,
  FilePathTarget,
  Input,
  Output,
  decryptBytes,
  type EncryptedPacket,
} from 'shifro';

// Decrypt bytes with your DRM library
async function decryptProtectedData({ scheme, data, iv }: EncryptedPacket) {
  // Your decryption logic here
}

async function runDecryption() {
  const decryption = await Decryption.init({
    input: new Input({
      source: new FilePathSource('./input.mp4'),
      // `decryptBytes` - helper function that allows to handle only the encrypted bytes. Clear sample bytes are not included.
      decryptSample: decryptBytes(decryptProtectedData),
    }),
    output: new Output({ target: new FilePathTarget('./output.mp4') }),
  });

  await decryption.execute();
}

Decrypting file using browser's Web Streams API

import { Decryption, Input, Output, ReadableStreamSource, StreamTarget } from 'shifro';
import type { Key, KeyId } from 'shifro';

async function decryptFromBrowser() {
  const handleFileSelect = async () => {
    return new Promise<File>((resolve) => {
      const input = document.querySelector<HTMLInputElement>('#input')!;
      input.addEventListener('change', () => resolve(input.files![0]));
    });
  };

  const inputFile = await handleFileSelect();
  const inputReadableStream = inputFile.stream();

  const outputFileHandle = window.showSaveFilePicker({
    suggestedName: 'output.mp4',
    startIn: 'downloads',
  });
  const outputWritableStream = await outputFileHandle.createWritable();

  const decryption = await Decryption.init({
    input: new Input({
      source: new ReadableStreamSource(inputReadableStream),
      keys: new Map<KeyId, Key>([
        ['4d97930a3d7b55fa81d0028653f5e499', '429ec76475e7a952d224d8ef867f12b6'],
        ['d21373c0b8ab5ba9954742bcdfb5f48b', '150a6c7d7dee6a91b74dccfce5b31928'],
      ]),
    }),
    output: new Output({ target: new StreamTarget(outputWritableStream) }),
  });

  decryption.onProgress = (progress) =>
    console.log(`Decrypting... [${Math.round(progress * 100)}%]`);

  await decryption.execute();
}

Credits