@browsery/highland

中文文档
2.13.6-rev.1发布于 2026/10/07MITTypeScriptES Module构建来源已验证近 30 天下载 3612

Browser compatible highland module

原始使用文档

@browsery/highland

Browser compatible highland!

This module bundles highland module for browsers!

Highland

The high-level streams library for Node.js and the browser. View the Highland website for more in-depth documentation.

build status Join the chat at https://gitter.im/caolan/highland

Introduction

Re-thinking the JavaScript utility belt, Highland manages synchronous and asynchronous code easily, using nothing more than standard JavaScript and Node-like Streams. You may be familiar with Promises, EventEmitters and callbacks, but moving between them is far from seamless. Thankfully, there exists a deeper abstraction which can free our code. By updating the tools we use on Arrays, and applying them to values distributed in time instead of space, we can discard plumbing and focus on the important things. With Highland, you can switch between synchronous and asynchronous data sources at will, without having to re-write your code. Time to dive in!

Made by @caolan, with help and patience from friends - Leave a tip or fork this :)

Examples

Usage as a Node.js module

var _ = require('highland');

Converting to/from Highland Streams

_([1,2,3,4]).toArray(function (xs) {
    // xs is [1,2,3,4]
});

Mapping over a Stream

var doubled = _([1,2,3,4]).map(function (x) {
    return x * 2;
});

Reading files in parallel (4 at once)

var data = _(filenames).map(readFile).parallel(4);

Handling errors

data.errors(function (err, rethrow) {
    // handle or rethrow error
});

Piping to a Node Stream

data.pipe(output);

Piping in data from Node Streams

var output = fs.createWriteStream('output');
var docs = db.createReadStream();

// wrap a node stream and pipe to file
_(docs).filter(isBlogpost).pipe(output);

// or, pipe in a node stream directly:
var through = _.pipeline(_.filter(isBlogpost));
docs.pipe(through).pipe(output);

Handling events

var clicks = _('click', btn).map(1);
var counter = clicks.scan(0, _.add);

counter.each(function (n) {
    $('#count').text(n);
});

Learn more at highlandjs.org

版本与发布记录

@browsery/highland 共发布 16 个版本,首次发布于 2023/01/10;过去 12 个月发布了 2 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
2.13.6-rev.1latest2026/10/071 个月前
2.13.6-r52026/04/047 个月前
2.13.6-r42024/08/202 年前
2.13.6-r32024/08/122 年前
2.13.6-r22024/08/112 年前
2.13.6-r12024/08/112 年前

关于 @browsery/highland 的常见问题

@browsery/highland 是什么?

Browser compatible highland module

如何安装 @browsery/highland?

在项目目录运行 npm install @browsery/highland,或使用 pnpm add / yarn add / bun add。

@browsery/highland 支持 TypeScript 吗?

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

@browsery/highland 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@browsery/highland 可以商用吗?

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

@browsery/highland 的下载量有多少?

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

@browsery/highland 还在维护吗?

最新版本 2.13.6-rev.1 发布于 2026/10/07(1 个月前);至今共发布 16 个版本,其中过去 12 个月发布了 2 个;首次发布于 2023/01/10。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。