🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

http-client-stream

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

http-client-stream

make http streams

latest
Source
npmnpm
Version
0.3.0
Version published
Maintainers
1
Created
Source

http-client-stream

Usage

Use http requests as streams:

var http = require('http-client-stream')
var endpoint = http('http://www.google.com')
var stream = endpoint.createStream()
process.stdin.pipe(stream.pipe(process.stdout))

Use request options to add methods:

var http = require('http-client-stream')
var endpoint = http('http://www.google.com')
var stream = endpoint.createStream({
  method: 'HEAD'
})
process.stdin.pipe(stream.pipe(process.stdout))

Use request options to add headers:

var http = require('http-client-stream')
var endpoint = http('http://www.google.com')
var stream = endpoint.createStream({
  headers: {
    'Range': 'bytes=9000-9001'
  }
})
process.stdin.pipe(stream.pipe(process.stdout))

CLI

You can even use the cli:

npm install -g http-client-stream
http-stream http://gateway.ipfs.io/ipfs/QmUW2JxCaELBzy6jhdQjmyvd7sv1EVpunE2kqQta3SekYM/big_buck_bunny.avi

And you can pass json opts

http-stream http://gateway.ipfs.io/ipfs/QmUW2JxCaELBzy6jhdQjmyvd7sv1EVpunE2kqQta3SekYM/big_buck_bunny.avi '{"headers": {"Range":"bytes=100-104"}}'

And a body

> echo beep boop | http-stream --body http://localhost/echo '{"method": "POST"}'
beep boop

Keywords

http

FAQs

Package last updated on 12 Apr 2015

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