{"library":"stream-to-observable","title":"Node.js Stream to ECMAScript Observable Converter","type":"library","description":"stream-to-observable is a utility package designed to convert Node.js Readable Streams into ECMAScript-compatible Observables. Released as version 0.2.0, this package has not seen updates since its publication seven years ago, indicating it is no longer actively maintained. It relies on `any-observable` to dynamically select an Observable implementation, requiring users to install a compatible library such as `zen-observable` or `rxjs` explicitly. While providing a bridge between traditional Node.js stream processing and the more declarative, reactive programming paradigm of Observables, its age means potential compatibility challenges with modern Node.js stream APIs or newer Observable library versions. A community-maintained fork, `@samverschueren/stream-to-observable`, exists due to this package's inactivity, which might be a more suitable alternative for current projects.","language":"javascript","status":"abandoned","last_verified":"Sat Apr 25","install":{"commands":["npm install stream-to-observable"],"cli":null},"imports":["const streamToObservable = require('stream-to-observable');"],"auth":{"required":false,"env_vars":[]},"links":{"homepage":null,"github":"https://github.com/jamestalmage/stream-to-observable","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/stream-to-observable","openapi_spec":null,"status_page":null,"smithery":null},"quickstart":{"code":"const fs = require('fs');\nconst split = require('split');\n\n// IMPORTANT: You must install an Observable implementation like zen-observable or rxjs.\n// e.g., npm install --save zen-observable\nrequire('any-observable/register')('zen'); // Register 'zen-observable' implementation\n\nconst streamToObservable = require('stream-to-observable');\n\n// Create a dummy file for demonstration\nfs.writeFileSync('./hello-world.txt', 'Hello, World!\\nThis is a test.\\nAnother line with hello.\\nGoodbye.');\n\nconst readStream = fs\n  .createReadStream('./hello-world.txt', {encoding: 'utf8'})\n  .pipe(split());\n\nconsole.log('Starting stream processing...');\n\nstreamToObservable(readStream)\n  .filter(chunk => /hello/i.test(chunk)) // Filter lines containing 'hello'\n  .map(chunk => chunk.toUpperCase())    // Convert to uppercase\n  .forEach(chunk => {\n    console.log(`Observable emitted: ${chunk}`); // Log filtered and mapped chunks\n  })\n  .catch(err => {\n    console.error('Observable error:', err);\n  })\n  .finally(() => {\n    console.log('Observable stream completed.');\n    fs.unlinkSync('./hello-world.txt'); // Clean up dummy file\n  });","lang":"javascript","description":"This quickstart demonstrates converting a Node.js `fs.createReadStream` into an Observable, filtering for lines containing 'hello', mapping them to uppercase, and logging the results. It also highlights the necessary registration of an Observable implementation.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}