{"id":13454470,"url":"https://github.com/caolan/highland","last_synced_at":"2025-05-13T20:22:10.500Z","repository":{"id":4411243,"uuid":"5548784","full_name":"caolan/highland","owner":"caolan","description":"High-level streams library for Node.js and the browser","archived":false,"fork":false,"pushed_at":"2020-06-18T07:57:58.000Z","size":5863,"stargazers_count":3422,"open_issues_count":128,"forks_count":145,"subscribers_count":66,"default_branch":"master","last_synced_at":"2025-05-06T04:03:57.115Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://caolan.github.io/highland","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/caolan.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"Contributing.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-08-25T05:18:11.000Z","updated_at":"2025-05-05T08:35:02.000Z","dependencies_parsed_at":"2022-07-10T03:00:20.441Z","dependency_job_id":null,"html_url":"https://github.com/caolan/highland","commit_stats":null,"previous_names":[],"tags_count":82,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caolan%2Fhighland","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caolan%2Fhighland/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caolan%2Fhighland/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caolan%2Fhighland/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/caolan","download_url":"https://codeload.github.com/caolan/highland/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253141554,"owners_count":21860544,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T08:00:54.398Z","updated_at":"2025-05-13T20:22:10.482Z","avatar_url":"https://github.com/caolan.png","language":"JavaScript","readme":"# Highland\n\nThe high-level streams library for Node.js and the browser.\nView the [Highland website](https://caolan.github.io/highland) for more in-depth\ndocumentation.\n\n[![build status](https://secure.travis-ci.org/caolan/highland.png)](http://travis-ci.org/caolan/highland)\n[![Join the chat at https://gitter.im/caolan/highland](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/caolan/highland?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\n## Introduction\n\nRe-thinking the [JavaScript](http://underscorejs.org)\n[utility](http://lodash.com) [belt](https://github.com/caolan/async),\nHighland manages synchronous and asynchronous code easily, using nothing more than\nstandard JavaScript and Node-like Streams.\nYou may be familiar with Promises, EventEmitters and callbacks, but moving\nbetween them is far from seamless. Thankfully, there exists a deeper abstraction\nwhich can free our code. By updating the tools we use on Arrays, and applying them\nto values distributed in time instead of space, we can discard plumbing and\nfocus on the important things. With Highland, you can switch between\nsynchronous and asynchronous data sources at will, without having to\nre-write your code. Time to dive in!\n\nMade by \u003ca href=\"http://twitter.com/caolan\"\u003e@caolan\u003c/a\u003e, with help and patience from friends :)\n\n## Highland v3\nThis branch tracks the ongoing development of version 3.0, which will feature a\nrewritten Highland core implementation, extensibility support, limited stream\nlifecycle, and some breaking changes to certain transforms.  See\n[#179](https://github.com/caolan/highland/issues/179) and the [3.x\nlabel](https://github.com/caolan/highland/issues?utf8=%E2%9C%93\u0026q=label%3A3.x%20)\nfor more details. New features will only be added to this branch. However,\nuntil 3.0 is released, we will still be doing bug fixes for the 2.x releases.\nSee the [2.x branch](https://github.com/caolan/highland/tree/2.x) for those\nfiles.\n\nCurrently, the code is in a semi-stable state. The only major missing feature\nis [`onDestroy` for higher-level\ntransforms](https://github.com/caolan/highland/issues/412). To try out the new\ngoodness, install the `next` tag from NPM.\n\n```\nnpm install --save highland@next\n```\n\n## Interoperability\n\nHighland implements the [Fantasy\nLand](https://github.com/fantasyland/fantasy-land)\n[Alternative](https://github.com/fantasyland/fantasy-land#alternative),\n[Filterable](https://github.com/fantasyland/fantasy-land#filterable), and\n[Monad](https://github.com/fantasyland/fantasy-land#monad)\nspecifications.\n\nHighland supports\n[Transducers](https://github.com/cognitect-labs/transducers-js) via the\n`transduce` transform.\n\n## Examples\n\nUsage as a Node.js module\n\n```javascript\nvar _ = require('highland');\n```\n\nConverting to/from Highland Streams\n\n```javascript\n_([1,2,3,4]).toArray(function (xs) {\n    // xs is [1,2,3,4]\n});\n```\n\nMapping over a Stream\n\n```javascript\nvar doubled = _([1,2,3,4]).map(function (x) {\n    return x * 2;\n});\n```\n\nReading files in parallel (4 at once)\n\n```javascript\nvar data = _(filenames).map(readFile).parallel(4);\n```\n\nHandling errors\n\n```javascript\ndata.errors(function (err, rethrow) {\n    // handle or rethrow error\n});\n```\n\nPiping to a Node Stream\n\n```javascript\ndata.pipe(output);\n```\n\nPiping in data from Node Streams\n\n```javascript\nvar output = fs.createWriteStream('output');\nvar docs = db.createReadStream();\n\n// wrap a node stream and pipe to file\n_(docs).filter(isBlogpost).pipe(output);\n\n// or, pipe in a node stream directly:\nvar through = _.pipeline(_.filter(isBlogpost));\ndocs.pipe(through).pipe(output);\n```\n\nHandling events\n\n```javascript\nvar clicks = _('click', btn).map(1);\nvar counter = clicks.scan(0, _.add);\n\ncounter.each(function (n) {\n    $('#count').text(n);\n});\n```\n\nLearn more at [https://caolan.github.io/highland/](https://caolan.github.io/highland/)\n","funding_links":[],"categories":["Packages","JavaScript","包","others","Control flow","目录"],"sub_categories":["Control flow","流程控制","控制流"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaolan%2Fhighland","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcaolan%2Fhighland","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaolan%2Fhighland/lists"}