{"id":13123,"library":"env-parser","title":"Streaming Environment Variable Parser","description":"env-parser (digitalsadhu/env-parser) is a streaming transform module designed to parse individual `key=value` pairs from a stream and emit JavaScript objects. It processes data by splitting on the first equals sign (`=`) and automatically removes quotation marks from values if present. As of version 1.0.1, last published in June 2015, this package appears to be unmaintained. Its primary use case is for integrating into Node.js stream pipelines where environment variable-like strings are being processed sequentially, rather than for parsing complete `.env` files. There are no indications of active development or a release cadence, and newer, more comprehensive environment variable parsing libraries are widely available.","status":"abandoned","version":"1.0.1","language":"javascript","source_language":"en","source_url":"git://github.com/digitalsadhu/env-parser","tags":["javascript","env","parser","streams","streaming",".env","ENV","process","process.env"],"install":[{"cmd":"npm install env-parser","lang":"bash","label":"npm"},{"cmd":"yarn add env-parser","lang":"bash","label":"yarn"},{"cmd":"pnpm add env-parser","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is a CommonJS module and exports a factory function. It does not support ES Modules directly. The exported function must be called to create a stream instance.","wrong":"import envParser from 'env-parser';\nimport { envParser } from 'env-parser';","symbol":"envParser","correct":"const envParser = require('env-parser');\nconst parserInstance = envParser();"},{"note":"The `env-parser` module returns a Node.js Transform stream instance. It's intended to be used within stream pipelines.","wrong":"import { Transform } from 'stream';","symbol":"Transform Stream","correct":"const { Transform } = require('stream');\nconst envParser = require('env-parser')();"}],"quickstart":{"code":"const { Readable } = require('stream');\nconst envParser = require('env-parser')();\n\n// Create a readable stream to feed data into the parser\nconst inputStream = new Readable({\n  read() {\n    this.push('ENV_KEY_1=\"some value with spaces\"\\n');\n    this.push('ENV_KEY_2=another_value\\n');\n    this.push('PATH_VAR=/usr/local/bin:/usr/bin\\n');\n    this.push(null); // No more data\n  }\n});\n\nenvParser.on('data', function (envObject) {\n  console.log('Parsed:', envObject);\n  // Expected output example:\n  // { key: 'ENV_KEY_1', value: 'some value with spaces' }\n  // { key: 'ENV_KEY_2', value: 'another_value' }\n  // { key: 'PATH_VAR', value: '/usr/local/bin:/usr/bin' }\n});\n\nenvParser.on('end', () => {\n  console.log('Parsing finished.');\n});\n\nenvParser.on('error', (err) => {\n  console.error('Parser error:', err.message);\n});\n\n// Pipe the input stream to the envParser transform stream\ninputStream.pipe(envParser);","lang":"javascript","description":"Demonstrates how to use `env-parser` as a Node.js Transform stream, feeding it simulated environment variable strings and listening for the parsed objects."},"warnings":[{"fix":"Use CommonJS `require()` syntax: `const envParser = require('env-parser');`","message":"This package is explicitly a CommonJS module and does not natively support ES Module `import` syntax. Attempting to use `import` will result in errors.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Consider migrating to actively maintained alternatives like `dotenv` for `.env` file parsing or a more robust streaming parser if your use case specifically requires line-by-line stream processing.","message":"The `env-parser` package (digitalsadhu/env-parser) has not been updated since June 2015 and is considered abandoned. It may contain unpatched vulnerabilities or incompatibilities with modern Node.js versions.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Ensure input data is formatted as single `KEY=VALUE` lines. For more complex `.env` parsing, use a dedicated library like `dotenv` or `envfile`. If comments are desired, they must be stripped from the input stream *before* passing to `env-parser`.","message":"This package is a basic streaming parser for *individual* `key=value` lines. It does not handle multi-line values, variable interpolation, comments (other than treating '#' as part of a value if not quoted), or full `.env` file semantics (like parsing an entire file). Each `write()` call or piped chunk is treated as a potential `key=value` pair.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Always invoke the required module as a function: `const parser = require('env-parser')();`","message":"The `env-parser` module exports a *factory function* which must be called to create a stream instance (`require('env-parser')()`). Forgetting the `()` will result in `TypeError: envParser is not a function` when attempting to use it as a stream.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Call the required module to get a stream instance: `const parser = require('env-parser')();`","cause":"The `env-parser` module exports a factory function, not a stream instance directly. You attempted to use the imported module directly as a stream without calling it.","error":"TypeError: envParser is not a function"},{"fix":"Use CommonJS `require()` syntax: `const envParser = require('env-parser');`. If you must use ESM, consider a CommonJS wrapper or a different, actively maintained package with ESM support.","cause":"You are attempting to use ES Module `import` syntax with a CommonJS-only package, or your Node.js environment is not configured for ESM for this file.","error":"SyntaxError: Unexpected token 'export' / Cannot use import statement outside a module"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":""}