{"id":27890109,"url":"https://github.com/webpod/envapi","last_synced_at":"2025-05-05T10:44:00.313Z","repository":{"id":270255289,"uuid":"909644583","full_name":"webpod/envapi","owner":"webpod","description":"An API to interact with environment files","archived":false,"fork":false,"pushed_at":"2025-04-06T11:38:23.000Z","size":366,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-06T12:28:22.233Z","etag":null,"topics":["dotenv","env"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/webpod.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-29T11:06:43.000Z","updated_at":"2025-04-06T11:38:23.000Z","dependencies_parsed_at":"2024-12-29T19:27:27.707Z","dependency_job_id":"5aaa27c9-0ba2-41d6-bdb5-796a7a1b9a9b","html_url":"https://github.com/webpod/envapi","commit_stats":null,"previous_names":["webpod/envapi"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpod%2Fenvapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpod%2Fenvapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpod%2Fenvapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpod%2Fenvapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webpod","download_url":"https://codeload.github.com/webpod/envapi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252485174,"owners_count":21755738,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dotenv","env"],"created_at":"2025-05-05T10:43:59.813Z","updated_at":"2025-05-05T10:44:00.308Z","avatar_url":"https://github.com/webpod.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# envapi\n\u003e An API to interact with environment files\n\n## Install\n```sh\nnpm install envapi\n``` \n\n## Usage\n```ts\nimport { parse, stringify, config, load, loadSafe } from 'envapi'\n\nconst input = `A=A\\nFOO=BAR`\nconst env = parse(input) // { A: 'A', FOO: 'BAR' }\nconst output = stringify(env) // A=A\\nFOO=BAR\n```\n\n### parse()\nParse a dotenv string into an object.\n\n```ts\nconst raw = `\nA=A\nFOO=BAR #comment`\n\nconst env = parse(raw) // { A: 'A', FOO: 'BAR' }\n```\n\n### stringify()\nStringify an object into a dotenv string.\n    \n```ts\nconst env = { A: 'A', FOO: 'BAR' }\nconst raw = stringify(env) // 'A=A\\nFOO=BAR'\n```\n\n### load()\nRead a dotenv file(s) and parse it into an object. `loadSafe()` suppresses ENOENT errors.\n```ts\nawait fs.writeFile('.env1', 'FOO=BAR')\nawait fs.writeFile('.env2', 'BAZ=QUX')\n\nconst env = load('.env1', '.env2')      // { FOO: 'BAR', BAZ: 'QUX' }\nconst _env = loadSafe('.env.notexists') // {}\n```\n\n\n### config()\nLoad a dotenv file into `process.env`.\n\n```ts\nconfig('.env1')\nprocess.env.FOO // BAR\n```\n\n## License\n[MIT](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebpod%2Fenvapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebpod%2Fenvapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebpod%2Fenvapi/lists"}