UNPKG

@zkochan/pnpm

Version:

Fast, disk space efficient package manager

100 lines (99 loc) 5.67 kB
{ "_args": [ [ { "raw": "split2@^2.1.0", "scope": null, "escapedName": "split2", "name": "split2", "rawSpec": "^2.1.0", "spec": ">=2.1.0 <3.0.0", "type": "range" }, "/home/zkochan/src/pnpm/packages/pnpm/node_modules/ndjson" ] ], "_from": "split2@>=2.1.0 <3.0.0", "_id": "split2@2.2.0", "_inCache": true, "_location": "/split2", "_nodeVersion": "6.11.1", "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/split2-2.2.0.tgz_1506330790940_0.4804259219672531" }, "_npmUser": { "name": "matteo.collina", "email": "hello@matteocollina.com" }, "_npmVersion": "5.4.2", "_phantomChildren": {}, "_requested": { "raw": "split2@^2.1.0", "scope": null, "escapedName": "split2", "name": "split2", "rawSpec": "^2.1.0", "spec": ">=2.1.0 <3.0.0", "type": "range" }, "_requiredBy": [ "/ndjson" ], "_resolved": "https://registry.npmjs.org/split2/-/split2-2.2.0.tgz", "_shasum": "186b2575bcf83e85b7d18465756238ee4ee42493", "_shrinkwrap": null, "_spec": "split2@^2.1.0", "_where": "/home/zkochan/src/pnpm/packages/pnpm/node_modules/ndjson", "author": { "name": "Matteo Collina", "email": "hello@matteocollina.com" }, "bugs": { "url": "http://github.com/mcollina/split2/issues" }, "dependencies": { "through2": "^2.0.2" }, "description": "split a Text Stream into a Line Stream, using Stream 3", "devDependencies": { "callback-stream": "^1.1.0", "fastbench": "^1.0.0", "pre-commit": "^1.1.2", "safe-buffer": "^5.1.1", "standard": "^10.0.0", "tap": "^10.0.0" }, "directories": {}, "dist": { "integrity": "sha512-RAb22TG39LhI31MbreBgIuKiIKhVsawfTgEGqKHTK87aG+ul/PB8Sqoi3I7kVdRWiCfrKxK3uo4/YUkpNvhPbw==", "shasum": "186b2575bcf83e85b7d18465756238ee4ee42493", "tarball": "https://registry.npmjs.org/split2/-/split2-2.2.0.tgz" }, "gitHead": "ba1f582661a1ebb3b1f6ea4059c98bd9a73b7a11", "homepage": "https://github.com/mcollina/split2#readme", "license": "ISC", "main": "index.js", "maintainers": [ { "name": "matteo.collina", "email": "hello@matteocollina.com" } ], "name": "split2", "optionalDependencies": {}, "pre-commit": [ "test" ], "readme": "# Split2(matcher, mapper, options)\n\n[![build status](https://secure.travis-ci.org/mcollina/split2.svg)](http://travis-ci.org/mcollina/split2)\n\nBreak up a stream and reassemble it so that each line is a chunk.\n`split2` is inspired by [@dominictarr](https://github.com/dominictarr) [`split`](https://github.com/dominictarr/split) module,\nand it is totally API compatible with it.\nHowever, it is based on [`through2`](https://github.com/rvagg/through2) by [@rvagg](https://github.com/rvagg) and it is fully based on Stream3.\n\n`matcher` may be a `String`, or a `RegExp`. Example, read every line in a file ...\n\n``` js\n fs.createReadStream(file)\n .pipe(split2())\n .on('data', function (line) {\n //each chunk now is a separate line!\n })\n\n```\n\n`split` takes the same arguments as `string.split` except it defaults to '/\\r?\\n/', and the optional `limit` paremeter is ignored.\n[String#split](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/split)\n\n`split` takes an optional options object on it's third argument, which\nis directly passed as a\n[Transform](http://nodejs.org/api/stream.html#stream_class_stream_transform_1)\noption.\n\nAdditionally, the `.maxLength` option is implemented, which will make the split stream throw an error\nif the buffer size exceeds `.maxLength`.\n\nCalling `.destroy` will make the stream emit `close`. Use this to perform cleanup logic\n\n``` js\nvar splitFile = function(filename) {\n var file = fs.createReadStream(filename)\n\n return file\n .pipe(split2())\n .on('close', function() {\n // destroy the file stream in case the split stream was destroyed\n file.destroy()\n })\n}\n\nvar stream = splitFile('my-file.txt')\n\nstream.destroy() // will destroy the input file stream\n```\n\n# NDJ - Newline Delimited Json\n\n`split2` accepts a function which transforms each line.\n\n``` js\nfs.createReadStream(file)\n .pipe(split2(JSON.parse))\n .on('data', function (obj) {\n //each chunk now is a js object\n })\n```\n\nHowever, in [@dominictarr](https://github.com/dominictarr) [`split`](https://github.com/dominictarr/split) the mapper\nis wrapped in a try-catch, while here it is not: if your parsing logic can throw, wrap it yourself.\n\n# License\n\nCopyright (c) 2014-2017, Matteo Collina <hello@matteocollina.com>\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted, provided that the above\ncopyright notice and this permission notice appear in all copies.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\nWITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\nANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\nWHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\nACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR\nIN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n", "readmeFilename": "README.md", "repository": { "type": "git", "url": "git+https://github.com/mcollina/split2.git" }, "scripts": { "test": "standard && tap -b test.js" }, "version": "2.2.0", "website": "https://github.com/mcollina/split2" }