@graphy/core.iso.stream
Advanced tools
Comparing version 3.2.2 to 4.0.0
47
main.js
@@ -1,4 +0,5 @@ | ||
const stream = require('stream'); | ||
const stream = require('readable-stream'); | ||
class Readable extends stream.Readable { | ||
@@ -144,2 +145,10 @@ constructor(gc_readable={}) { | ||
} | ||
// rdfjs impl | ||
import(ds_source) { | ||
return ds_source | ||
.on('data', w_chunk => this.write(w_chunk)) | ||
.on('end', () => this.end()) | ||
.on('error', e_read => this.emit('error', e_read)); | ||
} | ||
} | ||
@@ -370,2 +379,10 @@ | ||
// rdfjs impl | ||
import(ds_source) { | ||
return ds_source | ||
.on('data', w_chunk => this.write(w_chunk)) | ||
.on('end', () => this.end()) | ||
.on('error', e_read => this.emit('error', e_read)); | ||
} | ||
demolish(e_destroy) { | ||
@@ -390,3 +407,3 @@ // do not allow to push | ||
if(e_destroy) { | ||
return this.destroy(e_destroy); | ||
return stream.Transform.prototype.destroy.call(this, e_destroy); | ||
} | ||
@@ -442,5 +459,6 @@ } | ||
class Quads_To_Other extends Transform { | ||
constructor() { | ||
class QuadsToOther extends Transform { | ||
constructor(gc_transform={}) { | ||
super({ | ||
...gc_transform, | ||
writableObjectMode: true, | ||
@@ -450,4 +468,8 @@ readableObjectMode: true, | ||
this._as_inputs = new Set(); | ||
// forward prefix and comment events | ||
this.on('pipe', (ds_src) => { | ||
this._as_inputs.add(ds_src); | ||
ds_src | ||
@@ -461,6 +483,16 @@ .on('prefix', (...a_args) => { | ||
}); | ||
this.on('unpipe', (ds_src) => { | ||
this._as_inputs.delete(ds_src); | ||
}); | ||
} | ||
_destroy() { | ||
for(let ds_input of this._as_inputs) { | ||
ds_input.destroy(); | ||
} | ||
} | ||
} | ||
class Quads_To_JSON_Transform extends Quads_To_Other { | ||
class Quads_To_JSON_Transform extends QuadsToOther { | ||
// serializse json | ||
@@ -472,3 +504,3 @@ _transform(g_quad, s_encoding, fk_transform) { | ||
class Quads_To_Writable extends Quads_To_Other { | ||
class Quads_To_Writable extends QuadsToOther { | ||
_transform(g_quad, s_encoding, fk_transform) { | ||
@@ -482,2 +514,3 @@ fk_transform(null, { | ||
Transform.QuadsToOther = QuadsToOther; | ||
@@ -491,2 +524,4 @@ module.exports = { | ||
QuadsToOther, | ||
// create a transform from quad objects into JSON strings for trivial serialization | ||
@@ -493,0 +528,0 @@ quads_to_json() { |
{ | ||
"name": "@graphy/core.iso.stream", | ||
"version": "3.2.2", | ||
"version": "4.0.0", | ||
"description": "Provides isomorphic stream interface for node.js / browser and adds `.until`, a promisified version of the `.on` event listener", | ||
@@ -25,6 +25,8 @@ "keywords": [ | ||
"main": "main.js", | ||
"dependencies": {}, | ||
"dependencies": { | ||
"readable-stream": "^3.4.0" | ||
}, | ||
"engines": { | ||
"node": ">=8.4.0" | ||
} | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13056
471
1
+ Addedreadable-stream@^3.4.0
+ Addedinherits@2.0.4(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedstring_decoder@1.3.0(transitive)
+ Addedutil-deprecate@1.0.2(transitive)