# proxy-pac

> Get/set proxy auto-config (PAC) file. Currently only supports OS X.

Latest version **1.1.0** (published 2016-05-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install proxy-pac
pnpm add proxy-pac
yarn add proxy-pac
bun add proxy-pac
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2016-05-13 |
| First published | 2016-05-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 4 |
| Author | DaveJ |
| Maintainers | davej |
| Keywords | proxy, pac, networksetup, osx, os x, network |

## Links

- npm: https://www.npmjs.com/package/proxy-pac
- Repository: https://github.com/davej/proxy-pac
- Homepage: https://github.com/davej/proxy-pac#readme
- Issues: https://github.com/davej/proxy-pac/issues
- npm.io page: https://npm.io/package/proxy-pac

## Dependencies (3)

- [pify](https://npm.io/package/pify.md) ^2.3.0
- [execa](https://npm.io/package/execa.md) ^0.4.0
- [network](https://npm.io/package/network.md) ^0.1.3

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2016-05-13
- 1.0.1 — 2016-05-13
- 1.0.0 — 2016-05-13

## README

# proxy-pac [![Build Status](https://travis-ci.org/davej/proxy-pac.svg?branch=master)](https://travis-ci.org/davej/proxy-pac)

> Get/set proxy auto-config (PAC) file. Currently only supports OS X.


## Install

```
$ npm install --save proxy-pac
```


## Usage

```js
const proxyPac = require('proxy-pac');

proxyPac.getActiveService().then(activeDevice => console.log(activeDevice));
//=> 'Wi-Fi'

proxyPac.getAll().then(services => console.log(services));
//=> [ { name: 'Bluetooth DUN 2', url: null, enabled: false },
//     { name: 'Wi-Fi', url: 'http://test.com/proxy.pac', enabled: true },
//     { name: 'Bluetooth PAN', url: null, enabled: false },
//     { name: 'Thunderbolt Bridge', url: null, enabled: false } ]

proxyPac.getServices().then(services => console.log(services));
//=> [ 'Bluetooth DUN 2', 'Wi-Fi', 'Bluetooth PAN', 'Thunderbolt Bridge' ]

proxyPac.getNamed('Thunderbolt Bridge').then(pac => console.log(pac));
//=> { name: 'Thunderbolt Bridge', url: null, enabled: false }

proxyPac.setNamed('Thunderbolt Bridge', 'http:localhost:1234/proxy.pac')
  .then(pac => console.log(pac));
//=> { name: 'Thunderbolt Bridge', url: 'http:localhost:1234/proxy.pac', enabled: true }

proxyPac.resetNamed('Thunderbolt Bridge').then(pac => console.log(pac));
//=> { name: 'Thunderbolt Bridge', url: ' ', enabled: false }
// NOTE: I couldn't find a way to set url to null or empty-string so it is set
// to the space character (' ') instead.

// ----------------------------------------------------------------
// The APIs below perform the action on the current active service.
// ----------------------------------------------------------------

proxyPac.getCurrent().then(pac => console.log(pac));
//=> { name: 'Wi-Fi', url: 'http://test.com/proxy.pac', enabled: true }

proxyPac.setCurrent('http://foo.bar/hello.pac').then(pac => console.log(pac));
//=> { name: 'Wi-Fi', url: 'http://foo.bar/hello.pac', enabled: true }

proxyPac.resetCurrent().then(pac => console.log(pac));
//=> { name: 'Wi-Fi', url: ' ', enabled: false }


// ---------------------------------------------------------
// The APIs below perform the action on all active services.
// ---------------------------------------------------------

proxyPac.setAll('http://just-a-test/proxy.pac').then(services => console.log(services));
//=> [ { name: 'Bluetooth DUN 2', url: 'http://just-a-test/proxy.pac', enabled: true },
//     { name: 'Wi-Fi', url: 'http://just-a-test/proxy.pac', enabled: true },
//     { name: 'Bluetooth PAN', url: 'http://just-a-test/proxy.pac', enabled: true },
//     { name: 'Thunderbolt Bridge', url: 'http://just-a-test/proxy.pac', enabled: true } ]

proxyPac.resetAll().then(services => console.log(services));
//=> [ { name: 'Bluetooth DUN 2', url: ' ', enabled: false },
//     { name: 'Wi-Fi', url: ' ', enabled: false },
//     { name: 'Bluetooth PAN', url: ' ', enabled: false },
//     { name: 'Thunderbolt Bridge', url: ' ', enabled: false } ]

```


## License

MIT © [DaveJ](https://twitter.com/DaveJ)

---
_Source: https://npm.io/package/proxy-pac · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
