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

@kjots/stream-observable

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kjots/stream-observable - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

24

dist/index.js
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const stream_to_observable_1 = __importDefault(require("stream-to-observable"));
const stream_1 = require("stream");
const rxjs_1 = require("rxjs");
function streamObservable(stream) {
return stream_to_observable_1.default(stream);
return new rxjs_1.Observable((observer) => {
const observerWritable = new stream_1.Writable({
objectMode: true,
write(chunk, encoding, callback) {
observer.next(chunk);
callback();
},
final(callback) {
observer.complete();
callback();
}
});
stream
.on('error', error => observer.error(error))
.pipe(observerWritable);
return () => stream.unpipe(observerWritable);
});
}
exports.streamObservable = streamObservable;
//# sourceMappingURL=index.js.map
{
"name": "@kjots/stream-observable",
"version": "0.0.5",
"version": "0.0.6",
"description": "Stream Observable",

@@ -42,3 +42,2 @@ "main": "dist/index.js",

"rimraf": "^2.6.3",
"stream-array": "^1.1.2",
"ts-node": "^8.0.3",

@@ -49,6 +48,4 @@ "tslint": "^5.15.0",

"dependencies": {
"rxjs": "^6.4.0",
"rxjs-compat": "^6.4.0",
"stream-to-observable": "^0.2.0"
"rxjs": "^6.4.0"
}
}

@@ -1,4 +0,4 @@

import streamToObservable from 'stream-to-observable';
import { Writable } from 'stream';
import { Observable } from 'rxjs';
import { Observable, Observer } from 'rxjs';

@@ -8,3 +8,25 @@ import ReadableStream = NodeJS.ReadableStream;

export function streamObservable<T>(stream: ReadableStream): Observable<T> {
return streamToObservable(stream);
return new Observable((observer: Observer<T>) => {
const observerWritable = new Writable({
objectMode: true,
write(chunk: any, encoding: string, callback: () => void) {
observer.next(chunk);
callback();
},
final(callback: () => void) {
observer.complete();
callback();
}
});
stream
.on('error', error => observer.error(error))
.pipe(observerWritable);
return () => stream.unpipe(observerWritable);
});
}

Sorry, the diff of this file is not supported yet

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