Skip to content

Commit 19648ab

Browse files
committed
prevent buffer-browserify from getting included to reduce bundle size
1 parent 4c47f39 commit 19648ab

File tree

3 files changed

+41
-37
lines changed

3 files changed

+41
-37
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

lib/request.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
var Stream = require('stream');
22
var Response = require('./response');
3-
var concatStream = require('concat-stream')
4-
var Buffer = require('buffer')
3+
var concatStream = require('concat-stream');
4+
var Base64 = require('Base64');
55

66
var Request = module.exports = function (xhr, params) {
77
var self = this;
@@ -37,7 +37,7 @@ var Request = module.exports = function (xhr, params) {
3737

3838
if (params.auth) {
3939
//basic auth
40-
this.setHeader('Authorization', 'Basic ' + new Buffer(params.auth).toString('base64'));
40+
this.setHeader('Authorization', 'Basic ' + Base64.btoa(params.auth));
4141
}
4242

4343
var res = new Response;

package.json

Lines changed: 37 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,39 @@
11
{
2-
"name" : "http-browserify",
3-
"version" : "0.1.11",
4-
"description" : "http module compatability for browserify",
5-
"main" : "index.js",
6-
"browserify" : "index.js",
7-
"directories" : {
8-
"lib" : ".",
9-
"example" : "example",
10-
"test" : "test"
11-
},
12-
"dependencies": {
13-
"concat-stream": "0.0.8"
14-
},
15-
"devDependencies" : {
16-
"ecstatic" : "~0.1.6"
17-
},
18-
"repository" : {
19-
"type" : "git",
20-
"url" : "http://github.com/substack/http-browserify.git"
21-
},
22-
"keywords" : [
23-
"http",
24-
"browserify",
25-
"compatible",
26-
"meatless",
27-
"browser"
28-
],
29-
"author" : {
30-
"name" : "James Halliday",
31-
"email" : "[email protected]",
32-
"url" : "http://substack.net"
33-
},
34-
"license" : "MIT/X11",
35-
"engine" : { "node" : ">=0.4" }
2+
"name": "http-browserify",
3+
"version": "0.1.11",
4+
"description": "http module compatability for browserify",
5+
"main": "index.js",
6+
"browserify": "index.js",
7+
"directories": {
8+
"lib": ".",
9+
"example": "example",
10+
"test": "test"
11+
},
12+
"dependencies": {
13+
"concat-stream": "~1.0.0",
14+
"Base64": "~0.1.2"
15+
},
16+
"devDependencies": {
17+
"ecstatic": "~0.1.6"
18+
},
19+
"repository": {
20+
"type": "git",
21+
"url": "http://github.com/substack/http-browserify.git"
22+
},
23+
"keywords": [
24+
"http",
25+
"browserify",
26+
"compatible",
27+
"meatless",
28+
"browser"
29+
],
30+
"author": {
31+
"name": "James Halliday",
32+
"email": "[email protected]",
33+
"url": "http://substack.net"
34+
},
35+
"license": "MIT/X11",
36+
"engine": {
37+
"node": ">=0.4"
38+
}
3639
}

0 commit comments

Comments
 (0)