urlproxy

0.1.1 • Public • Published

urlproxy

NPM version Build Status Build Status NPM downloads

set a proxy for url using stream


Install

$ npm install urlproxy -g

Usage

var proxy = require('urlproxy');
proxy('a.js').pipe(res);

It will find the file in local directory. if not found, it will find from the proxy server, and cache to local if cache option is true.

custom ready event, when stream can be ready to pipe, when you use express or koa.

proxy('a.js')
.on('ready', function() {
  res.statusCode = 200;
})
.on('error', function() {
  res.statusCode = 404
  res.end('Not Found');
})
.pipe(res);

Option

  • directory: local directory, default process.cwd(),
  • proxy: set remote server
  • cache: cache remote file
  • followRedirect: follow redirect when 302

LISENCE

Copyright (c) 2014 popomore. Licensed under the MIT license.

Readme

Keywords

none

Package Sidebar

Install

npm i urlproxy

Weekly Downloads

0

Version

0.1.1

License

MIT

Last publish

Collaborators

  • popomore