{"id":28419209,"url":"https://github.com/reliverse/relifso","last_synced_at":"2026-01-28T07:13:31.774Z","repository":{"id":253627080,"uuid":"843957821","full_name":"reliverse/relifso","owner":"reliverse","description":"📂 @reliverse/relifso is a modern node and bun filesystem toolkit. drop-in replacement for node:fs and fs-extra — powered by native promises, built with es modules, and packed with dx-focused and bun-aware utilities.","archived":false,"fork":false,"pushed_at":"2025-06-03T00:18:08.000Z","size":859,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-12T17:45:29.071Z","etag":null,"topics":["bun","bunjs","filesystem","fs-extra","nodejs","npm-lib","npm-library","npm-package","relivator","reliverse"],"latest_commit_sha":null,"homepage":"https://reliverse.org","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/reliverse.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSES","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},"funding":{"github":"blefnk","patreon":"blefnk","buy_me_a_coffee":"blefnk","custom":["https://paypal.me/blefony","https://ko-fi.com/blefnk","https://donatello.to/blefnk"]}},"created_at":"2024-08-17T23:55:27.000Z","updated_at":"2025-06-03T00:18:12.000Z","dependencies_parsed_at":"2025-04-19T10:37:33.466Z","dependency_job_id":"1d2facee-cbb0-4a01-a112-24f9ea3eb6d1","html_url":"https://github.com/reliverse/relifso","commit_stats":null,"previous_names":["reliverse/fs","reliverse/relifso-node-fs-extra","reliverse/relifso","reliverse/relifso-bun-node-fs-extra"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/reliverse/relifso","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reliverse%2Frelifso","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reliverse%2Frelifso/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reliverse%2Frelifso/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reliverse%2Frelifso/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reliverse","download_url":"https://codeload.github.com/reliverse/relifso/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reliverse%2Frelifso/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262056191,"owners_count":23251618,"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":["bun","bunjs","filesystem","fs-extra","nodejs","npm-lib","npm-library","npm-package","relivator","reliverse"],"created_at":"2025-06-04T16:31:49.345Z","updated_at":"2026-01-28T07:13:31.696Z","avatar_url":"https://github.com/reliverse.png","language":"TypeScript","funding_links":["https://github.com/sponsors/blefnk","https://patreon.com/blefnk","https://buymeacoffee.com/blefnk","https://paypal.me/blefony","https://ko-fi.com/blefnk","https://donatello.to/blefnk"],"categories":[],"sub_categories":[],"readme":"# Relifso • Bun \u0026 Node.js Filesystem Toolkit Library\r\n\r\n[sponsor](https://github.com/sponsors/blefnk) — [discord](https://discord.gg/Pb8uKbwpsJ) — [npm](https://npmjs.com/package/@reliverse/relifso) — [github](https://github.com/reliverse/relifso)\r\n\r\n\u003e @reliverse/relifso is a modern node and bun filesystem toolkit. drop-in replacement for `node:fs` and `fs-extra` — powered by native promises, built with es modules, and packed with dx-focused and bun-aware utilities.\r\n\r\n## Features\r\n\r\n- 🔥 Both Node.js and Bun-specific filesystem features are exposed via `fs.*`\r\n- 🪄 Everything you love from `fs-extra` — now simpler, cleaner, and more beginner-friendly\r\n- ⚙️ Drop-in replacement for `node:fs` — with native `Promise`, `async/await`, and sync variants\r\n- 🤝 Forget about `try-catch` for common errors like \"file not found\" — relifso does it under the hood\r\n- 🧯 Gracefully handles errors like `EMFILE` (reading or writing a lot of files at once) and other edge cases\r\n- 📚 Consistent error-first behavior — even for legacy APIs like `fs.exists()`\r\n- 📦 First-class ESM and full TypeScript support — no config hacks required\r\n- 🧼 Zero bloat — small size, zero deps, modern code, no monkey-patching\r\n- 🎯 Supports all Node.js v16+ features — optimized for Node.js v22+\r\n- 🧪 Soon: Ready for upcoming Node.js v22+ experimental features\r\n- ✌️ Bun v1.2+ ready — ships with Bun-aware enhancements out of the box\r\n- 🐦‍🔥 Finally! Your `fs.*` usage is now can correctly read/write JSON/JSONC!\r\n- 🔧 Built-in JSON repair — automatically fixes common JSON formatting issues\r\n\r\n## Install\r\n\r\n```bash\r\n# bun • pnpm • yarn • npm\r\nbun add @reliverse/relifso\r\n```\r\n\r\n**Migrate**:\r\n\r\n```bash\r\nbun rm fs-extra\r\nbun rm @types/fs-extra\r\n# soon:\r\n# bun add -D @reliverse/dler\r\n# bun dler migrate fs-relifso\r\n```\r\n\r\n**Pro Tip**: _Use Ctrl+Shift+H to replace `fs-extra` with `@reliverse/relifso` in your project._\r\n\r\n### Core Features\r\n\r\n- **File Operations**\r\n  - Read/write files with various encodings\r\n  - Copy/move files and directories\r\n  - Create/remove files and directories\r\n  - File existence checks\r\n  - File stats and metadata access\r\n\r\n- **Directory Operations**\r\n  - Create nested directories\r\n  - Empty directories\r\n  - Directory traversal with `dive`\r\n  - Directory existence checks\r\n\r\n- **JSON Operations**\r\n  - Read/write JSON files with validation\r\n  - JSON repair and validation utilities\r\n  - JSON streaming support\r\n  - JSONC (JSON with Comments) support\r\n  - Automatic JSON repair for common issues:\r\n    - Missing quotes around keys\r\n    - Missing escape characters\r\n    - Missing commas and closing brackets\r\n    - Truncated JSON\r\n    - Single quotes to double quotes conversion\r\n    - Special quote characters normalization\r\n    - Special whitespace normalization\r\n    - Python constants (None, True, False) conversion\r\n    - Trailing comma removal\r\n    - Comment stripping\r\n    - Code block stripping\r\n    - Array/object ellipsis removal\r\n    - JSONP notation removal\r\n    - MongoDB data type conversion\r\n    - String concatenation\r\n    - Newline-delimited JSON conversion\r\n\r\n- **Bun Optimizations**\r\n  - Automatic runtime detection\r\n  - Optimized file operations using Bun APIs\r\n  - Fast file stats and metadata access\r\n  - Graceful fallbacks to Node.js APIs\r\n\r\n- **Utility Functions**\r\n  - File type detection\r\n  - Hidden file attribute handling\r\n  - Directory emptiness checks\r\n  - File size and last modified time access\r\n\r\n### Error Handling\r\n\r\n- Graceful handling of common filesystem errors\r\n- Consistent error types and messages\r\n- Automatic error recovery where possible\r\n- Detailed error information for debugging\r\n- Runtime detection errors\r\n- File operation failures\r\n- All Bun-specific operations include proper error handling\r\n- Automatic fallback from Bun to Node.js APIs when needed\r\n\r\n## Usage\r\n\r\nCheck [./e-relifso.ts](./e-relifso.ts) and [./e-pathkit.ts](./e-pathkit.ts) for a full examples. You can clone this repo and run via `bun dev`.\r\n\r\nRelifso works just like `fs-extra` — every method is promise-first, ergonomic, and future-ready.\r\n\r\n```ts\r\nimport { copy, pathExists, remove } from \"@reliverse/relifso\";\r\n\r\nawait copy(\"src/index.ts\", \"dist/index.ts\");\r\n\r\nif (await pathExists(\"dist/index.ts\")) {\r\n  await remove(\"dist/index.ts\");\r\n}\r\n```\r\n\r\n- ✨ Everything's bundled — modern, async, and type-safe.\r\n- 🧼 No more boilerplate like `promisify(fs.removeSync)` or using `mkdirp`, `ncp`, or `rimraf`.\r\n- 🌱 No more weird `try/catch` for common errors like \"file not found.\"  \r\n- ✌️ Just clean, predictable APIs built for 2025 and beyond.\r\n\r\n## Example\r\n\r\n```ts\r\nimport {\r\n  ensureDir,\r\n  outputJson,\r\n  readJson,\r\n  remove,\r\n} from \"@reliverse/relifso\";\r\n\r\nconst path = \"./.reliverse/config.json\";\r\n\r\nawait ensureDir(\".reliverse\");\r\nawait outputJson(path, { hello: \"world\" });\r\n\r\nconst config = await readJson(path);\r\nconsole.log(config); // { hello: 'world' }\r\n\r\nawait remove(\".reliverse\");\r\n```\r\n\r\n## Run Example\r\n\r\nInstall this repository locally and run the example by using `bun dev`:\r\n\r\n```bash\r\n$ bun e-mod.ts\r\n✓   Running examples with Bun...\r\nCreated directory ./tests-runtime\r\n[env] writeJson was successfully executed in Bun (for JSON)\r\nWrote JSON tests-runtime\\config.json\r\n[env] readJson was successfully executed in Bun\r\nRead JSON {\"hello\":\"world\",\"ts\":\"2025-06-02T19:01:53.291Z\"}\r\n[env] copy was successfully executed in Bun\r\nMoved → Copied (with overwrite) tests-runtime\\config.old.json → tests-runtime\\config.copy.json\r\n[env] readFile was successfully executed in Bun\r\nWrote \u0026 read text file Hello Relifso!\r\n[env] writeFile was successfully executed in Bun\r\n[env] writeFile was successfully executed in Bun\r\nEnsured nested \u0026 output files\r\n[env] writeJson was successfully executed in Bun (for JSON)\r\n[env] readJson was successfully executed in Bun\r\nwriteJson / readJson round-trip {\"foo\":\"bar\"}\r\n[env] writeJson was successfully executed in Bun (for JSONC)\r\nWrote JSONC tests-runtime\\config.jsonc\r\n[env] readJson was successfully executed in Bun\r\nRead JSONC {\r\n  \"name\": \"relifso\",\r\n  \"version\": \"1.0.0\",\r\n  \"features\": [\r\n    \"file operations\",\r\n    \"directory operations\",\r\n    \"JSONC support\"\r\n  ],\r\n  \"settings\": {\r\n    \"debug\": true,\r\n    \"verbose\": false\r\n  }\r\n}\r\nEmptied directory tests-runtime\\empty-me\r\n[env] writeFileSync was successfully executed in Bun\r\n[env] writeJsonSync was successfully executed in Bun (for JSON)\r\nSync JSON round-trip {\"sync\":true}\r\n[env] copySync was successfully executed in Bun\r\ncopySync → moveSync → removeSync chain complete\r\nDirectory structure via dive\r\n • tests-runtime\\config-sync.json\r\n • tests-runtime\\config.copy.json\r\n • tests-runtime\\config.jsonc\r\n • tests-runtime\\config.old.json\r\n • tests-runtime\\config2.json\r\n • tests-runtime\\hello.txt\r\n • tests-runtime\\nested\\deep\\file.txt\r\n • tests-runtime\\output-file.txt\r\nDirectory structure via diveSync\r\n • tests-runtime\\config-sync.json\r\n • tests-runtime\\config.copy.json\r\n • tests-runtime\\config.jsonc\r\n • tests-runtime\\config.old.json\r\n • tests-runtime\\config2.json\r\n • tests-runtime\\hello.txt\r\n • tests-runtime\\nested\\deep\\file.txt\r\n • tests-runtime\\output-file.txt\r\nRemoved directory ./tests-runtime\r\n```\r\n\r\n## Sync vs Async vs Legacy\r\n\r\nYou choose your flavor:\r\n\r\n```ts\r\n// Async/Await\r\nawait copy(\"a.txt\", \"b.txt\");\r\n\r\n// Sync\r\ncopySync(\"a.txt\", \"b.txt\");\r\n\r\n// Callback (legacy-style)\r\ncopy(\"a.txt\", \"b.txt\", err =\u003e {\r\n  if (err) console.error(err);\r\n});\r\n```\r\n\r\nAll async methods return a `Promise` if no callback is passed.\r\n\r\n## Fully Typed, Fully Modern\r\n\r\n- Written in modern ESM\r\n- Minimal dependencies\r\n- Full TypeScript declarations\r\n- Compatible with Node.js 16+, best with 22+\r\n- Async methods are built from the sync versions — no wrappers, no bloat\r\n\r\n## What's Inside?\r\n\r\n- All async methods follow the `Promise` pattern by default.\r\n- All sync methods are safe and throw errors when needed.\r\n\r\n### Async (recommended)\r\n\r\n#### Common Async Methods\r\n\r\n- [access](https://uwx-node-modules.github.io/fsxt/functions/access.html)\r\n- [appendFile](https://uwx-node-modules.github.io/fsxt/functions/appendFile.html)\r\n- [copy](https://uwx-node-modules.github.io/fsxt/functions/copy.html)\r\n- [copyFile](https://uwx-node-modules.github.io/fsxt/functions/copyFile.html)\r\n- [cp](https://uwx-node-modules.github.io/fsxt/functions/cp.html)\r\n- [createReadStream](https://uwx-node-modules.github.io/fsxt/functions/createReadStream.html)\r\n- [createWriteStream](https://uwx-node-modules.github.io/fsxt/functions/createWriteStream.html)\r\n- [ensureFile](https://uwx-node-modules.github.io/fsxt/functions/ensureFile.html)\r\n- [exists](https://uwx-node-modules.github.io/fsxt/functions/exists.html)\r\n- [mkdir](https://uwx-node-modules.github.io/fsxt/functions/mkdir.html)\r\n- [mkdirs](https://uwx-node-modules.github.io/fsxt/functions/mkdirs.html)\r\n- [move](https://uwx-node-modules.github.io/fsxt/functions/move.html)\r\n- [open](https://uwx-node-modules.github.io/fsxt/functions/open.html)\r\n- [outputFile](https://uwx-node-modules.github.io/fsxt/functions/outputFile.html)\r\n- [outputJson](https://uwx-node-modules.github.io/fsxt/functions/outputJson.html)\r\n- [read](https://uwx-node-modules.github.io/fsxt/functions/read.html)\r\n- [readdir](https://uwx-node-modules.github.io/fsxt/functions/readdir.html)\r\n- [readFile](https://uwx-node-modules.github.io/fsxt/functions/readFile.html)\r\n- [readJson](https://uwx-node-modules.github.io/fsxt/functions/readJson.html)\r\n- [readLines](https://uwx-node-modules.github.io/fsxt/functions/readLines.html)\r\n- [readText](https://uwx-node-modules.github.io/fsxt/functions/readText.html)\r\n- [rename](https://uwx-node-modules.github.io/fsxt/functions/rename.html)\r\n- [rm](https://uwx-node-modules.github.io/fsxt/functions/rm.html)\r\n- [rmdir](https://uwx-node-modules.github.io/fsxt/functions/rmdir.html)\r\n- [stat](https://uwx-node-modules.github.io/fsxt/functions/stat.html)\r\n- [symlink](https://uwx-node-modules.github.io/fsxt/functions/symlink.html)\r\n- [truncate](https://uwx-node-modules.github.io/fsxt/functions/truncate.html)\r\n- [unlink](https://uwx-node-modules.github.io/fsxt/functions/unlink.html)\r\n- [watch](https://uwx-node-modules.github.io/fsxt/functions/watch.html)\r\n- [watchFile](https://uwx-node-modules.github.io/fsxt/functions/watchFile.html)\r\n- [write](https://uwx-node-modules.github.io/fsxt/functions/write.html)\r\n- [writeFile](https://uwx-node-modules.github.io/fsxt/functions/writeFile.html)\r\n- [writeJson](https://uwx-node-modules.github.io/fsxt/functions/writeJson.html)\r\n\r\n#### Less Commonly Used Async Methods\r\n\r\n- [chmod](https://uwx-node-modules.github.io/fsxt/functions/chmod.html)\r\n- [chown](https://uwx-node-modules.github.io/fsxt/functions/chown.html)\r\n- [close](https://uwx-node-modules.github.io/fsxt/functions/close.html)\r\n- [dive](https://uwx-node-modules.github.io/fsxt/functions/dive.html)\r\n- [emptyDir](https://uwx-node-modules.github.io/fsxt/functions/emptyDir.html)\r\n- [ensureLink](https://uwx-node-modules.github.io/fsxt/functions/ensureLink.html)\r\n- [ensureSymlink](https://uwx-node-modules.github.io/fsxt/functions/ensureSymlink.html)\r\n- [fchmod](https://uwx-node-modules.github.io/fsxt/functions/fchmod.html)\r\n- [fchown](https://uwx-node-modules.github.io/fsxt/functions/fchown.html)\r\n- [forEachChild](https://uwx-node-modules.github.io/fsxt/functions/forEachChild.html)\r\n- [fstat](https://uwx-node-modules.github.io/fsxt/functions/fstat.html)\r\n- [ftruncate](https://uwx-node-modules.github.io/fsxt/functions/ftruncate.html)\r\n- [futimes](https://uwx-node-modules.github.io/fsxt/functions/futimes.html)\r\n- [gracefulify](https://uwx-node-modules.github.io/fsxt/functions/gracefulify.html)\r\n- [isDirectory](https://uwx-node-modules.github.io/fsxt/functions/isDirectory.html)\r\n- [isSymlink](https://uwx-node-modules.github.io/fsxt/functions/isSymlink.html)\r\n- [~~lchmod~~](https://uwx-node-modules.github.io/fsxt/functions/lchmod.html)\r\n- [lchown](https://uwx-node-modules.github.io/fsxt/functions/lchown.html)\r\n- [`link`](https://uwx-node-modules.github.io/fsxt/functions/link.html)\r\n- [lstat](https://uwx-node-modules.github.io/fsxt/functions/lstat.html)\r\n- [lutimes](https://uwx-node-modules.github.io/fsxt/functions/lutimes.html)\r\n- [mapChildren](https://uwx-node-modules.github.io/fsxt/functions/mapChildren.html)\r\n- [mapStructure](https://uwx-node-modules.github.io/fsxt/functions/mapStructure.html)\r\n- [mapStructureOrdered](https://uwx-node-modules.github.io/fsxt/functions/mapStructureOrdered.html)\r\n- [mkdtemp](https://uwx-node-modules.github.io/fsxt/functions/mkdtemp.html)\r\n- [openAsBlob](https://uwx-node-modules.github.io/fsxt/functions/openAsBlob.html)\r\n- [opendir](https://uwx-node-modules.github.io/fsxt/functions/opendir.html)\r\n- [readv](https://uwx-node-modules.github.io/fsxt/functions/readv.html)\r\n- [realpath](https://uwx-node-modules.github.io/fsxt/functions/realpath.html)\r\n- [remove](https://uwx-node-modules.github.io/fsxt/functions/remove.html)\r\n- [resolve](https://uwx-node-modules.github.io/fsxt/functions/resolve.html)\r\n- [statfs](https://uwx-node-modules.github.io/fsxt/functions/statfs.html)\r\n- [unwatchFile](https://uwx-node-modules.github.io/fsxt/functions/unwatchFile.html)\r\n- [utimes](https://uwx-node-modules.github.io/fsxt/functions/utimes.html)\r\n- [vacuum](https://uwx-node-modules.github.io/fsxt/functions/vacuum.html)\r\n- [writev](https://uwx-node-modules.github.io/fsxt/functions/writev.html)\r\n\r\n### Sync\r\n\r\n#### Common Sync Methods\r\n\r\n- [accessSync](https://uwx-node-modules.github.io/fsxt/functions/accessSync.html)\r\n- [appendFileSync](https://uwx-node-modules.github.io/fsxt/functions/appendFileSync.html)\r\n- [copyFileSync](https://uwx-node-modules.github.io/fsxt/functions/copyFileSync.html)\r\n- [copySync](https://uwx-node-modules.github.io/fsxt/functions/copySync.html)\r\n- [cpSync](https://uwx-node-modules.github.io/fsxt/functions/cpSync.html)\r\n- [existsSync](https://uwx-node-modules.github.io/fsxt/functions/existsSync.html)\r\n- [mkdirSync](https://uwx-node-modules.github.io/fsxt/functions/mkdirSync.html)\r\n- [mkdirsSync](https://uwx-node-modules.github.io/fsxt/functions/mkdirsSync.html)\r\n- [moveSync](https://uwx-node-modules.github.io/fsxt/functions/moveSync.html)\r\n- [openSync](https://uwx-node-modules.github.io/fsxt/functions/openSync.html)\r\n- [outputFileSync](https://uwx-node-modules.github.io/fsxt/functions/outputFileSync.html)\r\n- [outputJsonSync](https://uwx-node-modules.github.io/fsxt/functions/outputJsonSync.html)\r\n- [readdirSync](https://uwx-node-modules.github.io/fsxt/functions/readdirSync.html)\r\n- [readFileSync](https://uwx-node-modules.github.io/fsxt/functions/readFileSync.html)\r\n- [readJsonSync](https://uwx-node-modules.github.io/fsxt/functions/readJsonSync.html)\r\n- [readTextSync](https://uwx-node-modules.github.io/fsxt/functions/readTextSync.html)\r\n- [renameSync](https://uwx-node-modules.github.io/fsxt/functions/renameSync.html)\r\n- [rmSync](https://uwx-node-modules.github.io/fsxt/functions/rmSync.html)\r\n- [rmdirSync](https://uwx-node-modules.github.io/fsxt/functions/rmdirSync.html)\r\n- [statSync](https://uwx-node-modules.github.io/fsxt/functions/statSync.html)\r\n- [symlinkSync](https://uwx-node-modules.github.io/fsxt/functions/symlinkSync.html)\r\n- [truncateSync](https://uwx-node-modules.github.io/fsxt/functions/truncateSync.html)\r\n- [unlinkSync](https://uwx-node-modules.github.io/fsxt/functions/unlinkSync.html)\r\n- [writeFileSync](https://uwx-node-modules.github.io/fsxt/functions/writeFileSync.html)\r\n- [writeJsonSync](https://uwx-node-modules.github.io/fsxt/functions/writeJsonSync.html)\r\n- [writeSync](https://uwx-node-modules.github.io/fsxt/functions/writeSync.html)\r\n\r\n#### Less Commonly Used Sync Methods\r\n\r\n- [chmodSync](https://uwx-node-modules.github.io/fsxt/functions/chmodSync.html)\r\n- [chownSync](https://uwx-node-modules.github.io/fsxt/functions/chownSync.html)\r\n- [closeSync](https://uwx-node-modules.github.io/fsxt/functions/closeSync.html)\r\n- [diveSync](https://uwx-node-modules.github.io/fsxt/functions/diveSync.html)\r\n- [emptyDirSync](https://uwx-node-modules.github.io/fsxt/functions/emptyDirSync.html)\r\n- [ensureFileSync](https://uwx-node-modules.github.io/fsxt/functions/ensureFileSync.html)\r\n- [ensureLinkSync](https://uwx-node-modules.github.io/fsxt/functions/ensureLinkSync.html)\r\n- [ensureSymlinkSync](https://uwx-node-modules.github.io/fsxt/functions/ensureSymlinkSync.html)\r\n- [fchmodSync](https://uwx-node-modules.github.io/fsxt/functions/fchmodSync.html)\r\n- [fchownSync](https://uwx-node-modules.github.io/fsxt/functions/fchownSync.html)\r\n- [fdatasync](https://uwx-node-modules.github.io/fsxt/functions/fdatasync.html)\r\n- [fdatasyncSync](https://uwx-node-modules.github.io/fsxt/functions/fdatasyncSync.html)\r\n- [forEachChildSync](https://uwx-node-modules.github.io/fsxt/functions/forEachChildSync.html)\r\n- [fstatSync](https://uwx-node-modules.github.io/fsxt/functions/fstatSync.html)\r\n- [fsync](https://uwx-node-modules.github.io/fsxt/functions/fsync.html)\r\n- [fsyncSync](https://uwx-node-modules.github.io/fsxt/functions/fsyncSync.html)\r\n- [ftruncateSync](https://uwx-node-modules.github.io/fsxt/functions/ftruncateSync.html)\r\n- [futimesSync](https://uwx-node-modules.github.io/fsxt/functions/futimesSync.html)\r\n- [isDirectorySync](https://uwx-node-modules.github.io/fsxt/functions/isDirectorySync.html)\r\n- [~~lchmodSync~~](https://uwx-node-modules.github.io/fsxt/functions/lchmodSync.html)\r\n- [lchownSync](https://uwx-node-modules.github.io/fsxt/functions/lchownSync.html)\r\n- [linkSync](https://uwx-node-modules.github.io/fsxt/functions/linkSync.html)\r\n- [lstatSync](https://uwx-node-modules.github.io/fsxt/functions/lstatSync.html)\r\n- [lutimesSync](https://uwx-node-modules.github.io/fsxt/functions/lutimesSync.html)\r\n- [mkdirsSync](https://uwx-node-modules.github.io/fsxt/functions/mkdirsSync.html)\r\n- [mkdtempSync](https://uwx-node-modules.github.io/fsxt/functions/mkdtempSync.html)\r\n- [opendirSync](https://uwx-node-modules.github.io/fsxt/functions/opendirSync.html)\r\n- [readLinesSync](https://uwx-node-modules.github.io/fsxt/functions/readLinesSync.html)\r\n- [readlinkSync](https://uwx-node-modules.github.io/fsxt/functions/readlinkSync.html)\r\n- [readSync](https://uwx-node-modules.github.io/fsxt/functions/readSync.html)\r\n- [readvSync](https://uwx-node-modules.github.io/fsxt/functions/readvSync.html)\r\n- [realpathSync](https://uwx-node-modules.github.io/fsxt/functions/realpathSync.html)\r\n- [removeSync](https://uwx-node-modules.github.io/fsxt/functions/removeSync.html)\r\n- [statfsSync](https://uwx-node-modules.github.io/fsxt/functions/statfsSync.html)\r\n- [utimesSync](https://uwx-node-modules.github.io/fsxt/functions/utimesSync.html)\r\n- [writevSync](https://uwx-node-modules.github.io/fsxt/functions/writevSync.html)\r\n\r\n## Bun Integration\r\n\r\nRelifso provides first-class support for Bun with automatic fallbacks to Node.js APIs. Here's how it works:\r\n\r\n### JSON Repair Integration\r\n\r\nRelifso includes built-in JSON repair capabilities powered by `jsonrepair`, providing robust handling of malformed JSON files. This integration is particularly useful when dealing with JSON files that may have formatting issues or come from various sources.\r\n\r\n#### Repair Features\r\n\r\n- **Automatic Repair**: Automatically fixes common JSON formatting issues without requiring manual intervention\r\n- **Streaming Support**: Handles infinitely large JSON documents through streaming\r\n- **Error Recovery**: Gracefully handles and repairs various JSON syntax errors\r\n- **Performance Optimized**: Efficient processing with configurable buffer sizes\r\n\r\n#### Usage Example\r\n\r\n```ts\r\nimport { readJson, writeJson } from \"@reliverse/relifso\";\r\n\r\n// Reading a malformed JSON file\r\nconst malformedJson = `{\r\n  name: 'John',  // Missing quotes and using single quotes\r\n  age: 30,\r\n  active: True,  // Python-style boolean\r\n  tags: ['dev', 'js', ...],  // Trailing ellipsis\r\n  metadata: {\r\n    lastLogin: ISODate(\"2024-03-20T10:00:00Z\")  // MongoDB date\r\n  }\r\n}`;\r\n\r\n// The JSON will be automatically repaired when reading\r\nconst data = await readJson(\"config.json\");\r\nconsole.log(data);\r\n// Output: Properly formatted JSON with all issues fixed\r\n\r\n// Writing JSON with automatic repair\r\nawait writeJson(\"output.json\", data, { repair: true });\r\n```\r\n\r\n#### Streaming Support\r\n\r\nFor large JSON files, you can use the streaming API:\r\n\r\n```ts\r\nimport { createReadStream, createWriteStream } from \"@reliverse/relifso\";\r\n\r\nconst inputStream = createReadStream(\"./data/broken.json\");\r\nconst outputStream = createWriteStream(\"./data/repaired.json\");\r\n\r\n// The repair happens automatically during the stream\r\nawait pipeline(inputStream, outputStream);\r\n```\r\n\r\n#### Configuration Options\r\n\r\nWhen using JSON operations, you can configure the repair behavior:\r\n\r\n```ts\r\nimport { readJson } from \"@reliverse/relifso\";\r\n\r\nconst options = {\r\n  repair: true,  // Enable automatic repair\r\n  streaming: {\r\n    chunkSize: 65536,    // Size of output chunks\r\n    bufferSize: 65536    // Size of repair buffer\r\n  }\r\n};\r\n\r\nconst data = await readJson(\"large.json\", options);\r\n```\r\n\r\n### Automatic Runtime Detection\r\n\r\n```ts\r\nimport { isBun } from \"@reliverse/relifso\";\r\n\r\nif (isBun) {\r\n  console.log(\"Running in Bun!\");\r\n} else {\r\n  console.log(\"Running in Node.js\");\r\n}\r\n```\r\n\r\n### Optimized File Operations\r\n\r\nWhen running in Bun, relifso automatically uses Bun's optimized file system APIs:\r\n\r\n- `Bun.file()` for file operations\r\n- Native file existence checks\r\n- Optimized file size and type detection\r\n- Fast last modified time access\r\n\r\n### Graceful Fallbacks\r\n\r\nAll Bun-specific operations include automatic fallbacks to Node.js APIs:\r\n\r\n```ts\r\nimport { getStats } from \"@reliverse/relifso\";\r\n\r\n// In Bun: Uses Bun.file() for faster stats\r\n// In Node.js: Falls back to fs.stat()\r\nconst stats = await getStats(\"file.txt\");\r\n```\r\n\r\n### Available Bun-Specific Utilities\r\n\r\n- `getFile(path)` - Get a Bun file reference\r\n- `exists(path)` - Check file existence using Bun's API\r\n- `size(path)` - Get file size using Bun's API\r\n- `type(path)` - Get file MIME type using Bun's API\r\n- `lastModified(path)` - Get file last modified time\r\n- `getStats(path)` - Get file stats with Bun optimization\r\n- `getStatsSync(path)` - Synchronous version of getStats\r\n\r\n## Contributing\r\n\r\n...\r\n\r\n## TODO\r\n\r\n- [x] Create usage example in [./example/e-relifso.ts](./example/e-relifso.ts) and [./example/e-pathkit.ts](./example/e-pathkit.ts)\r\n- [x] Ensure [./example/e-relifso.ts](./example/e-relifso.ts) and [./example/e-pathkit.ts](./example/e-pathkit.ts) works 100% correctly\r\n- [ ] Consider using [@reliverse/repath](https://github.com/reliverse/repath) instead of just `node:path`.\r\n- [ ] Pass all `fs-extra` tests with Bun (+ fix \u0026 improve them).\r\n- [ ] In [docs.reliverse.org](https://docs.reliverse.org) implement feature and performance comparison table with `fs-extra`.\r\n\r\n## Shoutouts\r\n\r\nRelifso wouldn't be so cool without these gems:\r\n\r\n- [`node:fs`](https://nodejs.org/api/fs.html)+[`node:path`](https://nodejs.org/api/path.html) — origins\r\n- [`fs-extra`](https://github.com/jprichardson/node-fs-extra) — classic, reliable\r\n- [`fsxt`](https://github.com/uwx-node-modules/fsxt) — full fs-extra overhaul\r\n\r\n## Show Some Love\r\n\r\nIf `@reliverse/relifso` reduced the number of lines in your codebase:\r\n\r\n- ⭐ [Star it on GitHub](https://github.com/reliverse/relifso)\r\n- 💖 [Sponsor @blefnk](https://github.com/sponsors/blefnk)\r\n- 🧙 Recommend it to your dev friends\r\n\r\n## License\r\n\r\n[MIT](./LICENSE) © 2025 [Nazar Kornienko (blefnk)](https://github.com/blefnk)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freliverse%2Frelifso","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freliverse%2Frelifso","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freliverse%2Frelifso/lists"}