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

flext-file

v1.0.2

Published

A technology for building reliable document templates

Readme

Flext File

Static Badge Static Badge

trustme24_flext_cover.jpg

Flext File is a portable file format and runtime adapter for moving Flext documents between systems.

In many document workflows, templates, assets, and metadata are stored as separate parts. This works at first, but over time it becomes difficult to move documents between services, open them in another environment, or reproduce the same result later. Flext File addresses this problem by packaging a document into a single .flext artifact and restoring it back into a runtime Flext object when needed.

A Flext File container can hold the template, a manifest, and related assets in one zip-based file. This makes documents easier to preview, transfer, store, and reopen across different parts of a document pipeline.


Installation

npm i flext-file @trustme24/flext

🎉 That's It!


The Problem

Document generation often depends on more than one file. A template may reference assets, metadata, or other runtime information that must stay aligned when the document is moved to another service or opened later.

Typical issues include: templates and assets being transferred separately, missing resource files, weak contracts between systems, and difficulty reproducing the same document outside the original environment.

trustme24_flext_abstract_painting.jpg

A few common scenarios illustrate the problem:

  1. A service generates a document, but the receiving side only gets part of the required files.
    Solution with Flext File: The document can be packed into one .flext container so template and assets travel together.

————————————

  1. A frontend needs to preview a prepared document without access to the original project structure.
    Solution with Flext File: The container can be opened directly and restored into a runtime Flext object for preview.

————————————

  1. A document must be stored and reopened later with predictable structure.
    Solution with Flext File: The file carries an explicit manifest and a stable internal layout instead of relying on implicit folder conventions.

What It Provides

Flext File builds on top of Flext and acts as a companion format for portable document artifacts. The goal is not to replace Flext itself, but to give Flext-based workflows a standard file container for transport and reproduction.

Instead of treating a prepared document as a loose collection of files, Flext File treats it as a single structured artifact. A .flext file can include a template, a manifest, and related assets, all stored together inside a zip-based container.

This approach helps systems exchange prepared documents with a clearer contract and reopen them later without depending on the original project layout.

Quick Start:

import FlextFile from 'flext-file';

const file = await FlextFile.from(arrayBuffer, true);

const html = file.data.html;
const css = await file.data.getCss();

document.body.innerHTML = html;

Core Ideas

A Flext File container has two important roles. The first role is storage: it defines a portable .flext file that keeps the template and assets together. The second role is runtime recovery: the container can be deserialized back into a Flext object so existing Flext-based rendering flows can continue to work.

Keeping the document structure in one file makes it easier to move across services and reduces hidden assumptions about where assets or template parts are stored.

The internal structure is intentionally simple. A container includes a manifest, the template, and asset entries. The manifest describes where these parts are located and which format version the file uses.

Example

.
├── assets
│   └── cat.jpg
├── manifest.json
└── template.hbs
{
  "v": "1.0",
  "template": "/template.hbs",
  "assets": {
    "cat": "/assets/cat.jpg"
  }
}

💡 In this example the container carries an explicit manifest and file map. This allows another environment to reopen the document with a predictable structure instead of guessing how the template and assets were originally arranged.


Use Cases

trustme24_flext_use_cases.jpg

Flext File is intended for structured document transport and reproduction. A common example is browser preview of a prepared .flext document uploaded by a user. It is also useful when a document must be transferred between services as one binary artifact, stored for later reopening, or distributed without exposing the original source project structure.

Flext File can be used on its own as a file format and adapter, but it is mainly designed to work inside the broader Flext ecosystem. It fits naturally into pipelines where Flext prepares a document and another application later previews, delivers, or processes that result.

Together these parts allow Flext-based systems to move documents more reliably while keeping the core document logic in Flext itself.


Creating and Reading Files

Flext File is designed to keep the API small. In the most common path, a developer reads a file from an ArrayBuffer, restores it with FlextFile.from(...), and then uses the recovered Flext object as usual.

Example:

import FlextFile from 'flext-file';

const file = await FlextFile.from(arrayBuffer, true);

console.log(file.data.html);
console.log(await file.data.getCss());

The library also exposes methods for converting runtime data back into a binary artifact. This makes it possible to build storage, transfer, or download flows around the same format.

Best practices

Treat .flext files as versioned document artifacts. Prefer explicit manifest-driven structure over ad hoc zip layouts. Keep preview logic isolated in the consumer application and test file flows with realistic templates and assets.

Limitations

Flext File is intentionally focused. It is not a template engine, not a PDF renderer, not a WYSIWYG editor, and not a complete document management system. Its role is to act as a portable file layer for Flext-based document workflows.

Preview security is also outside the scope of the format itself. Applications that render HTML and CSS from a .flext file should define their own isolation and security model.


API

The main entry point is the FlextFile class.

Static method usage:

import FlextFile from 'flext-file';

await FlextFile.from(arrayBuffer, true);

The package also includes lower-level helpers for reading and writing buffers when a more controlled integration is needed.

More information about the API is available at TrustMe Wiki.


Architecture

Flext File operates as a simple pipeline.

Template / Assets
  v
Flext
  v
Flext File
  v
Flext
  v
Preview / Delivery / Storage

At runtime Flext File reads the container, parses the manifest, restores the template and assets, and rebuilds a Flext object. The recovered document can then be passed to other tools to display, store, or process further.


Development

npm run test:app

More information about contribution can be found in CONTRIBUTING.md.


Roadmap

Future development focuses on improving reliability and adoption. Planned areas include stronger format validation, clearer compatibility rules, better serialization and deserialization guarantees, richer documentation, ecosystem integrations, and more complete examples for browser and service-based workflows.

trustme24_flext_abstract_painting.jpg

  • Contributions are welcome. Useful areas include documentation, example integrations, validation improvements, compatibility testing, and test coverage. Changes that affect the file format or manifest semantics should first be discussed in issues so format decisions remain coherent.

————————————

  • Governance: Flext File is maintained by TrustMe. External contributions are encouraged while core format decisions remain centralized to keep the runtime and file contract consistent.

————————————

  • Security: If you discover a security issue, please report it privately to [email protected] instead of opening a public issue

————————————


Flext File by Kenny Romanov
TrustMe