mississippi
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
concat-stream | 1.6.2 | 3.72 kB | MIT | prod | |
duplexify | 3.7.1 | 4.92 kB | MIT | prod | |
end-of-stream | 1.4.4 | 2.33 kB | MIT | prod | |
flush-write-stream | 1.1.1 | 2.47 kB | MIT | prod | |
from2 | 2.3.0 | 3.65 kB | MIT | prod | |
pump | 1.0.3 | 2.92 kB | MIT | prod | |
pumpify | 1.5.1 | 3.4 kB | MIT | prod | |
stream-each | 1.2.3 | 2.7 kB | MIT | prod | |
through2 | 2.0.5 | 3.96 kB | MIT | prod |
Mississippi is a utility package for Node.js, providing a collection of useful stream modules. Its main aim is to simplify working with Node.js streams without compromising speed, error handling, or composability. The package includes several methods such as pipe, each, pipeline, duplex, and through among others, each offering different functionalities to make stream handling much easier.
You can use Mississippi by first installing the package using npm:
npm install mississippi
Then, you can require the package in your Node.js files:
var miss = require('mississippi')
The mississippi package provides various methods for handling streams. Here are some usage examples:
// Using the pipe method
var fs = require('fs')
var read = fs.createReadStream('./original.zip')
var write = fs.createWriteStream('./copy.zip')
miss.pipe(read, write, function (err) {
if (err) return console.error('Copy error!', err)
console.log('Copied successfully')
})
// Using the each method
var newLineSeparatedNumbers = fs.createReadStream('numbers.txt')
var pipeline = miss.pipeline(newLineSeparatedNumbers, split())
var sum = 0
function eachLine (line, next) {
sum += parseInt(line.toString())
next()
}
miss.each(pipeline, eachLine, function(err){
if (err) throw err
console.log('sum is', sum)
})
Each method of the package may have a different usage, so it's recommended to check the documentation for specific methods.
Mississippi's documentation can be found in the README file of the project's Github repository. It provides a detailed overview and usage examples of all the available methods in the Mississippi utility package. Helpful related resources on streams can be found in the "see also" section of the document including links to the stream handbook and node.js API documentation.