New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

json-lines

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-lines - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

5

lib/route/Client.js

@@ -26,2 +26,7 @@ 'use strict';

Client.prototype.close = function () {
this.res.end();
this.res.removeAllListeners();
};
module.exports = Client;

2

package.json
{
"name": "json-lines",
"version": "0.1.0",
"version": "0.2.0",
"description": "json-lines streams JSON Lines.",

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

@@ -39,2 +39,8 @@ # json-lines

If you want to close the connection, call the `close` function. This will emit the `close` event and clean up any event listeners.
```javascript
client.close();
```
## Running the build

@@ -41,0 +47,0 @@

@@ -59,2 +59,40 @@ 'use strict';

test('is able to close a client.', function (done) {
app.get('/', route(function (client) {
client.once('open', function () {
client.send({ foo: 'bar' });
client.close();
});
}));
http.get('http://localhost:' + port, function (res) {
res.once('data', function (data) {
assert.that(JSON.parse(data.toString())).is.equalTo({ foo: 'bar' });
});
res.once('end', function () {
done();
});
});
});
test('emits a close event when the client is closed from the server.', function (done) {
app.get('/', route(function (client) {
client.once('open', function () {
client.close();
});
client.once('close', function () {
done();
});
}));
http.get('http://localhost:' + port, function (res) {
setTimeout(function () {
res.socket.end();
res.removeAllListeners();
}, 0.5 * 1000);
});
});
test('cleans up when the client disconnects.', function (done) {

@@ -61,0 +99,0 @@ app.get('/', route(function (client) {

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