@emscripten-forge/untarjs

中文文档
5.4.1发布于 2026/11/09MITTypeScriptCommonJS近 30 天下载 2356

A simple project to unzip .zip, .tar.bz2 and .conda files in the front-end

原始使用文档

Untarjs

Fetching and unpacking archives. This package uses compiled libarchive into wasm and supports: tar, bzip2, zstd, zlib, zip, ustar, pax, v7, gnutar, cpio, mtree.

Note: To add the support of another archive format, libarchive should be compiled again with --with-[name-archive-lib] into wasm here Libarchive recipe and then run yarn run build in this project to make new unpack.js and unpack.wasm files.

Using

This package has 2 methods:

  • extract(url) - downloads an archive through the url and returns extracted data as an object representing the file structure:
{
    "file1": Uint8Array
    "info/paths.json":  Uint8Array,
    ...
}
  • exctractData(data) - accepts Uint8Array archive data and returns exracted data in the same format which extract method does.

The example of using:

import { initUntarJS } from "@emscripten-forge/untarjs";

const untarjs = await initUntarJS();

const condaPackageUrl = 'https://conda.anaconda.org/conda-forge/linux-64/_libgcc_mutex-0.1-conda_forge.tar.bz2';
untarjs.extract(condaPackageUrl).then((files)=>{
    console.log(files);
});

Note: If this package is used in the project where Webpack is used then webpack.config should include next:

resolve: {
   fallback: {
     "path": require.resolve("path-browserify"),
     "crypto": require.resolve("crypto-browserify"),
     "stream": require.resolve("stream-browserify"),
     "buffer": require.resolve("buffer/"),
     "process": require.resolve("process/browser"),
     "assert": require.resolve("assert/"),
     "http": require.resolve("stream-http"),
     "https": require.resolve("https-browserify"),
     "os": require.resolve("os-browserify/browser"),
     "url": require.resolve("url/"),
     "fs": require.resolve("browserify-fs"),
     "vm": require.resolve("vm-browserify")
   }
 },

版本与发布记录

@emscripten-forge/untarjs 共发布 15 个版本,首次发布于 2024/10/25;过去 12 个月发布了 3 个版本。

版本发布日期距今
5.4.1latest2026/11/094 天前
5.4.02026/11/0310 天前
5.3.32026/02/039 个月前
5.3.22025/10/171.1 年前
5.3.12025/10/141.1 年前
5.3.02025/02/181.7 年前

关于 @emscripten-forge/untarjs 的常见问题

@emscripten-forge/untarjs 是什么?

A simple project to unzip .zip, .tar.bz2 and .conda files in the front-end

如何安装 @emscripten-forge/untarjs?

在项目目录运行 npm install @emscripten-forge/untarjs,或使用 pnpm add / yarn add / bun add。

@emscripten-forge/untarjs 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@emscripten-forge/untarjs 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@emscripten-forge/untarjs 可以商用吗?

@emscripten-forge/untarjs 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@emscripten-forge/untarjs 的下载量有多少?

根据 npm 官方下载统计,@emscripten-forge/untarjs 在 2026/10/14 – 2026/11/12 这 30 天内被下载 2,356 次,日均约 79 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@emscripten-forge/untarjs 还在维护吗?

最新版本 5.4.1 发布于 2026/11/09(4 天前);至今共发布 15 个版本,其中过去 12 个月发布了 3 个;首次发布于 2024/10/25。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。