WIP - add extractor, generate snippet_data
This commit is contained in:
5
node_modules/killable/LICENSE
generated
vendored
Normal file
5
node_modules/killable/LICENSE
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
Copyright 2014 Marten de Vries
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
55
node_modules/killable/README.md
generated
vendored
Normal file
55
node_modules/killable/README.md
generated
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
killable
|
||||
========
|
||||
|
||||
Keeps track of a server's open sockets so they can be destroyed at a
|
||||
moment's notice. This way, the server connection can be killed very
|
||||
fast.
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
```
|
||||
npm install killable
|
||||
```
|
||||
|
||||
Example usage
|
||||
-------------
|
||||
|
||||
Using express:
|
||||
('server' in the example is just an ``http.server``, so other frameworks
|
||||
or pure Node should work just as well.)
|
||||
|
||||
```javascript
|
||||
var killable = require('killable');
|
||||
|
||||
var app = require('express')();
|
||||
var server;
|
||||
|
||||
app.route('/', function (req, res, next) {
|
||||
res.send('Server is going down NOW!');
|
||||
|
||||
server.kill(function () {
|
||||
//the server is down when this is called. That won't take long.
|
||||
});
|
||||
});
|
||||
|
||||
var server = app.listen(8080);
|
||||
killable(server);
|
||||
```
|
||||
|
||||
API
|
||||
---
|
||||
|
||||
The ``killable`` module is callable. When you call it on a Node
|
||||
``http.Server`` object, it will add a ``server.kill()`` method on it. It
|
||||
returns the server object.
|
||||
|
||||
``server.kill([callback])`` closes all open sockets and calls
|
||||
``server.close()``, to which the ``callback`` is passed on.
|
||||
|
||||
Inspired by: http://stackoverflow.com/a/14636625
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
ISC
|
||||
24
node_modules/killable/index.js
generated
vendored
Normal file
24
node_modules/killable/index.js
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
module.exports = function makeKillable(server) {
|
||||
var sockets = [];
|
||||
|
||||
server.on('connection', function (socket) {
|
||||
//add socket to list
|
||||
sockets.push(socket);
|
||||
|
||||
socket.once('close', function () {
|
||||
//remove socket from list
|
||||
sockets.splice(sockets.indexOf(socket), 1);
|
||||
});
|
||||
});
|
||||
|
||||
server.kill = function (cb) {
|
||||
server.close(cb);
|
||||
sockets.forEach(function (socket) {
|
||||
socket.destroy();
|
||||
});
|
||||
// reset so the server can be restarted
|
||||
sockets = [];
|
||||
};
|
||||
|
||||
return server;
|
||||
};
|
||||
55
node_modules/killable/package.json
generated
vendored
Normal file
55
node_modules/killable/package.json
generated
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
{
|
||||
"_from": "killable@^1.0.1",
|
||||
"_id": "killable@1.0.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-LzqtLKlUwirEUyl/nicirVmNiPvYs7l5n8wOPP7fyJVpUPkvCnW/vuiXGpylGUlnPDnB7311rARzAt3Mhswpjg==",
|
||||
"_location": "/killable",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "killable@^1.0.1",
|
||||
"name": "killable",
|
||||
"escapedName": "killable",
|
||||
"rawSpec": "^1.0.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/webpack-dev-server"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/killable/-/killable-1.0.1.tgz",
|
||||
"_shasum": "4c8ce441187a061c7474fb87ca08e2a638194892",
|
||||
"_spec": "killable@^1.0.1",
|
||||
"_where": "/Users/stefanfejes/Projects/30-seconds-of-python-code/node_modules/webpack-dev-server",
|
||||
"author": {
|
||||
"name": "Marten de Vries"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/marten-de-vries/killable/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Keeps track of a server's open sockets so they can be destroyed at a moment's notice.",
|
||||
"homepage": "https://github.com/marten-de-vries/killable#readme",
|
||||
"keywords": [
|
||||
"express",
|
||||
"http",
|
||||
"server",
|
||||
"socket",
|
||||
"kill",
|
||||
"truncate",
|
||||
"destroy",
|
||||
"restart",
|
||||
"shutdown",
|
||||
"immeadiately"
|
||||
],
|
||||
"license": "ISC",
|
||||
"main": "index.js",
|
||||
"name": "killable",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/marten-de-vries/killable.git"
|
||||
},
|
||||
"version": "1.0.1"
|
||||
}
|
||||
Reference in New Issue
Block a user