Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

httpiped-stream

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

httpiped-stream

prettier streams for httpiped

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

httpiped-stream

abstracted transform streams for httpiped

httpiped-stream allows you to create a Transform stream suitable for use with httpiped. The use case of this is to provide a similar method of creating "middleware" like Express.

Installation

npm install httpiped-stream

Example

var HTTPiped = require("httpiped");
var crStream = require("httpiped-stream").createStream;
var http = require("http");

var server = http.createServer();

var stream = new HTTPiped(server);

var setData = crStream(function (req, res, done) {
    req.someData = "Hello, world!\n";
    done();
});

var logger = crStream(function (req, res, done) {
    console.log("request from", req.connection.remoteAddress);
    done();
});

var handler = crStream(function (req, res, done) {
    res.end(req.someData);
    done();
});

stream.pipe(setData)
      .pipe(logger)
      .pipe(handler);

server.listen(8050);

Keywords

FAQs

Package last updated on 29 Jun 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc