🚀 Launch Week Day 2:Introducing Custom Tabs for Org Alerts.Learn More →
Socket
Book a DemoInstallSign in
Socket

urlencode-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

urlencode-stream

A streams2 Transform stream that urlencodes the text piped through it.

latest
Source
npmnpm
Version
1.1.0
Version published
Weekly downloads
1
-80%
Maintainers
1
Weekly downloads
 
Created
Source

You need to URL encode a stream you're sending to a web server somewhere. You want this:

var fs = require('fs');
var request = require('request');
var URLEncodeStream = require('urlencode-stream');
var handler = require('./response-handler');


fs.createReadStream('./sample-data.txt')
  .pipe(new URLEncodeStream())
  .pipe(request('http://example.com/postme', handler));

If you want to go fully application/x-www-form-urlencoded on the results, create the stream with the option spaceToPlus set to true:

var urler = new URLEncodeStream({spaceToPlus : true});

The default is to leave spaces alone.

Depends on streams2, one way or another. If you're running 0.10.x, it'll use the built-in streams. If you're running Node 0.8.x, it'll use readable-stream. If you're running an earlier Node, you're outta luck, chum. Maybe it's time to upgrade?

Keywords

streams2

FAQs

Package last updated on 12 Jun 2013

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