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

@keeex/fusion-io

v2.2.1

Published

I/O operations for `@keeex/js-fusion` and `@keeex/js-fusion-verifier`

Readme

@keeex/fusion-io

Bugs Code Smells Maintainability Rating Security Rating Vulnerabilities Technical Debt Coverage

Collection of classes to handle various kind of I/O depending on the available environment. This is used with KeeeX tools that have to interact with our Fusion product; it is shared between the private packages and the public packages.

General usage

You have to create input and output files separately. This library provides multiple classes for input and output that can be used depending on your execution environment/runtime.

The general layout is as follow:

  • create an input file
  • create an output file
  • pass them to KeeeX tools
  • close the input file
  • save/close the output file

For input files, the close() function is all you need. For output files, they will close themselves after you call saveOutput(). Alternatively, some implementation will also provide a failureClose() function that can be used in case of error, to close the resource without saving the content. If so, calling failureClose() after saveOutput() is acceptable, and will be a no-op.

Secure usage

Using input/output requires calling close functions after usage, even in case of errors. This is an example on how it can be done.

import * as kxReactNative from "@keeex/fusion-io/reactnative.js";
import Fusion from "@keeex/js-fusion/web/fusion/index.js";

import type {KeeexCmdOptions, KeeexCmdOutput} from "@keeex/fusion-types/fusion/cmd/keeex.js";
import type {IKeypair} from "@keeex/js-keys/shared/keypair.js";

import "@keeex/crypto-provider-reactnative";

export const keeexFile = async ({
  filePath,
  key,
  license,
  destPath,
}: {
  filePath: string;
  key: IKeypair;
  license: string;
  destPath: string;
}): Promise<{
  res: KeeexCmdOutput;
  destPath: string;
}> => {
  const kxInputFile = await kxReactNative.KxInput.createFromPath(filePath, null);
  try {
    const kxFileOutput = kxReactNative.KxOutput.createFromPath(destPath);
    try {
      const fusion = new Fusion({license});

      const kxOptions: KeeexCmdOptions = {
        optimization: {
          noIdxInSrc: true,
          srcNotKeeexed: true,
        },
      };

      const res = await fusion.keeex({
        dst: kxFileOutput,
        mdata: {
          author: "Mobile app",
          description: "",
          identities: {type: "kxkey", key},
          name: "Media",
          previous: [],
          properties: {},
          references: [],
        },
        options: kxOptions,
        src: kxInputFile,
      });

      kxFileOutput.saveOutput();
      return {res, destPath};
    } catch (err) {
      kxFileOutput.failureClose();
      console.error(err);
      throw new Error("Error keeexing file");
    }
  } catch (err) {
    console.error(err);
    throw new Error("Error keeexing file");
  } finally {
    kxInputFile.close();
  }
};

Generic buffers

These classes are available in all JavaScript environments. They only operate on Uint8Array instances, so fully work in memory.

import * as kxBuf8 from "@keeex/fusion-io/buf8.js";

const data: Uint8Array;

const input = kxBuf8.KxInput.create(data, true, "somefile.jpg");
const output = new kxBuf8.KxOutput();
// Process
const result: Uint8Array = output.saveOutput();

NodeJs FS

These are only available in NodeJs environments, and works with files on regular file systems.

import * as kxNodeFs from "@keeex/fusion-io/nodefs.js";

const input = await kxNodeFs.KxInput.createFromPath("/some/file.jpg", true, "mydata.jpg");
// It is important to provide the `input` to allow for some optimization and special cases
const output = await kxNodeFs.KxOutput.createOutputFile("/some/output.jpg", input);
// Process
await output.saveOutput();

Browser/Blob

For browsers, only an input is currently provided. Later versions will support creating output files using browser APIs.

import * as kxBlob from "@keeex/fusion-io/browserblob.js";

const blob: Blob;
const input = await kxBlob.KxInput.createFromBlob(blob, true);

React-Native

Support for React-Native specific files requires the installation of the following dependencies in the top-level of your application:

  • react-native-nitro-file-system
  • react-native-nitro-modules
  • react-native-nitro-buffer

The path arguments are the same as the react-native-nitro-file-system ones. The library should handle gracefully passing full path, without protocol prefix, unless you're actually reading from a custom resource.

Two variant are provided; the regular ones (recommended) have synchronous underlying calls. The Async variant can be used if you need more interlacing to keep your main thread more reactive.

Input

Synchronous (recommended):

import * as kxReactNative from "@keeex/fusion-io/reactnative.js";

const input = await kxReactNative.KxInput.createFromPath("/some/file.jpg", true, "mydata.jpg");
const output = kxReactNative.KxOutput.createOutputFile("/some/output.jpg");
// Process
// File is fully written and closed only after this call
output.saveOutput();

Asynchronous:

import * as kxReactNative from "@keeex/fusion-io/reactnative.js";

const input = await kxReactNative.async.KxInput.createFromPath(
  "/some/file.jpg",
  true,
  "mydata.jpg",
);
const output = await kxReactNative.async.KxOutput.createOutputFile("/some/output.jpg");
// Process
// File is fully written and closed only after this call
await output.saveOutput();