{"id":15022148,"url":"https://github.com/bent10/loadee","last_synced_at":"2025-09-10T04:36:14.638Z","repository":{"id":38030438,"uuid":"464412571","full_name":"bent10/loadee","owner":"bent10","description":"A utility to simplify the loading of YAML, JSON, and JS files.","archived":false,"fork":false,"pushed_at":"2025-08-17T03:52:28.000Z","size":831,"stargazers_count":3,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-17T05:30:05.929Z","etag":null,"topics":["config","js","json","load","loader","loading","rc","util","yaml","yml"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/loadee","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/bent10.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,"zenodo":null}},"created_at":"2022-02-28T09:14:48.000Z","updated_at":"2025-08-17T03:51:28.000Z","dependencies_parsed_at":"2024-04-20T02:35:57.068Z","dependency_job_id":"06e13a6e-2e9d-468f-9d41-836de117aed1","html_url":"https://github.com/bent10/loadee","commit_stats":{"total_commits":237,"total_committers":5,"mean_commits":47.4,"dds":"0.47679324894514763","last_synced_commit":"543a84ee9186d4f9df582e030aa3e2aae451a18e"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/bent10/loadee","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bent10%2Floadee","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bent10%2Floadee/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bent10%2Floadee/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bent10%2Floadee/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bent10","download_url":"https://codeload.github.com/bent10/loadee/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bent10%2Floadee/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274412055,"owners_count":25280197,"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","status":"online","status_checked_at":"2025-09-10T02:00:12.551Z","response_time":83,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["config","js","json","load","loader","loading","rc","util","yaml","yml"],"created_at":"2024-09-24T19:57:31.497Z","updated_at":"2025-09-10T04:36:14.609Z","avatar_url":"https://github.com/bent10.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# loadee\n\nA utility to simplify the loading of various types of files, including YAML, JSON, and CommonJS or ES modules. This module provides both synchronous and asynchronous functions for loading data and modules based on file extensions.\n\n## Install\n\nYou can install `loadee` using npm or yarn:\n\n```bash\nnpm i loadee\n# or\nyarn add loadee\n```\n\n## Usage\n\nTo use `loadee`, you can import it into your JavaScript or TypeScript project and utilize its various functions for loading files and modules.\n\n### Asynchronous Loading\n\n#### `loadFile\u003cT = any\u003e(pathlike: PathLike, cwd?: string, ...args: unknown[]): Promise\u003cT\u003e`\n\nLoads data from a file asynchronously based on its file extension.\n\n- `pathlike`: The path-like value representing the file.\n- `cwd` (optional): The current working directory. Defaults to the process's current working directory.\n- `...args` (optional): Additional arguments to pass to the loaded module if it's a function.\n\nTo load data from a YAML file asynchronously:\n\n```js\nimport { loadFile } from 'loadee'\n\ntry {\n  const data = await loadFile('data.yaml')\n  console.log('Loaded YAML data:', data)\n} catch (error) {\n  console.error('Error loading YAML data:', error)\n}\n```\n\nTo load data from a JSON file asynchronously:\n\n```js\nimport { loadFile } from 'loadee'\n\ntry {\n  const data = await loadFile('data.json')\n  console.log('Loaded JSON data:', data)\n} catch (error) {\n  console.error('Error loading JSON data:', error)\n}\n```\n\nTo load a CommonJS or ES module from a JavaScript file asynchronously:\n\n```js\nimport { loadFile } from 'loadee'\n\ntry {\n  const module = await loadFile('module.js')\n  console.log('Loaded JavaScript module:', module)\n} catch (error) {\n  console.error('Error loading JavaScript module:', error)\n}\n```\n\n### Synchronous Loading\n\n#### `loadFileSync\u003cT = any\u003e(pathlike: PathLike, cwd?: string, ...args: unknown[]): T`\n\nLoads data from a file synchronously based on its file extension.\n\n- `pathlike`: The path-like value representing the file.\n- `cwd` (optional): The current working directory. Defaults to the process's current working directory.\n- `...args` (optional): Additional arguments to pass to the loaded module if it's a function.\n\nTo load data from a YAML file synchronously:\n\n```js\nimport { loadFileSync } from 'loadee'\n\ntry {\n  const data = loadFileSync('data.yaml')\n  console.log('Loaded YAML data:', data)\n} catch (error) {\n  console.error('Error loading YAML data:', error)\n}\n```\n\nTo load data from a JSON file synchronously:\n\n```js\nimport { loadFileSync } from 'loadee'\n\ntry {\n  const data = loadFileSync('data.json')\n  console.log('Loaded JSON data:', data)\n} catch (error) {\n  console.error('Error loading JSON data:', error)\n}\n```\n\nTo load a JavaScript file synchronously:\n\n```js\nimport { loadFileSync } from 'loadee'\n\ntry {\n  const module = loadFileSync('module.js')\n  console.log('Loaded CommonJS:', module)\n} catch (error) {\n  console.error('Error loading CommonJS:', error)\n}\n```\n\n**NOTE:** The `loadFileSync` function cannot be used to load ES module files. When you attempt to load a `.js` file using this function, it will be treated as a CommonJS module.\n\n## Supported File Types\n\n`loadee` supports loading the following file types:\n\n- `.yaml` and `.yml` files: Loaded asynchronously and synchronously.\n- `.json` files: Loaded asynchronously and synchronously.\n- `.js`, `.mjs`, and `.cjs` files: Loaded asynchronously and synchronously.\n\n## Related\n\n- [`rcfy`](https://github.com/bent10/rcfy) – Finds and loads runtime-configuration file for the current project with precedence.\n\n## Contributing\n\nWe 💛\u0026nbsp; issues.\n\nWhen committing, please conform to [the semantic-release commit standards](https://www.conventionalcommits.org/). Please install `commitizen` and the adapter globally, if you have not already.\n\n```bash\nnpm i -g commitizen cz-conventional-changelog\n```\n\nNow you can use `git cz` or just `cz` instead of `git commit` when committing. You can also use `git-cz`, which is an alias for `cz`.\n\n```bash\ngit add . \u0026\u0026 git cz\n```\n\n## License\n\n![GitHub](https://img.shields.io/github/license/bent10/loadee)\n\nA project by [Stilearning](https://stilearning.com) \u0026copy; 2021-2024.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbent10%2Floadee","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbent10%2Floadee","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbent10%2Floadee/lists"}