Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

flexus-net

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flexus-net - npm Package Compare versions

Comparing version 1.0.9 to 1.1.0

2

package.json
{
"name": "flexus-net",
"version": "1.0.9",
"version": "1.1.0",
"description": "wrapper for node net module",

@@ -5,0 +5,0 @@ "keywords": [

# flexus-net
## What and why?
This is (for now) just a simple wrapper module that makes lifes easier when installing Node.js `net` module with JSPM for usage in browser-like app enviroments. Namely in Chrome packages apps and Windows modern apps.
Chrome provides quirky and overly complex [`chrome.sockets.tcp`](https://developer.chrome.com/apps/sockets_tcp) API for TCP socket communication which is wrapped by wonderful module [`chrome-net`](https://github.com/feross/chrome-net/) to provide the same API as Node.js `net`.
And `flexus-net` basically just wraps `chrome-net` with intention to implement similar wrapper for Windows API in the future.
## installation
```

@@ -14,15 +19,22 @@ jspm install npm:flexus-net

## tips & tricks
You can rename the module from `flexus-net` to `net` in your JSPM config file and then use it simply as
```js
import net from 'net';
```
or
```js
var net = require('net');
```
Sweet. Now how to do it?
In JSPM config file there is property `map` with names and mappings of all modules. This is an example of JSPM 0.17 `jspm.config.js`
```js
map: {
"flexus-net": "npm:flexus-net@1.0.8",
"flexus-net": "npm:flexus-net@1.1.0",
"events": "github:jspm/nodelibs-events@0.2.0-alpha",

@@ -32,11 +44,16 @@ "process": "github:jspm/nodelibs-process@0.2.0-alpha",

```
where you change the name like so
```js
map: {
"net": "npm:flexus-net@1.0.8",
"net": "npm:flexus-net@1.1.0",
...
```
Now you can write your app with `net` module like you would in Node and JSPM handles picking the right module for given enviroment. When runnig in Chrome App the `chrome-net` is used in background or when run in Node using `JSPM run path_to_your.js` the native module is used.
## thanks to
Feross Aboukhadijeh, John Hiesey & Jan Schä for creating [`chrome-net`](https://github.com/feross/chrome-net/) and Guy Bedford for [`JSPM`](https://github.com/jspm/jspm-cli)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc