{"id":26448475,"url":"https://github.com/therayvoice/ray-fs","last_synced_at":"2026-05-20T19:09:07.307Z","repository":{"id":65482593,"uuid":"377258902","full_name":"therayvoice/ray-fs","owner":"therayvoice","description":"A library with easy to use, mind blowing file-system tools for NodeJS. Based on FS! with chainable methods, sync first approach, and amazing UX.","archived":false,"fork":false,"pushed_at":"2021-07-07T16:24:48.000Z","size":33,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-29T08:35:44.992Z","etag":null,"topics":["chainable-methods","filesystem","fs","hacktoberfest","nodejs","synchronous"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/therayvoice.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-15T18:26:59.000Z","updated_at":"2021-10-08T02:29:59.000Z","dependencies_parsed_at":"2023-01-25T10:45:34.578Z","dependency_job_id":null,"html_url":"https://github.com/therayvoice/ray-fs","commit_stats":null,"previous_names":["ray6464/ray-fs"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/therayvoice/ray-fs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/therayvoice%2Fray-fs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/therayvoice%2Fray-fs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/therayvoice%2Fray-fs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/therayvoice%2Fray-fs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/therayvoice","download_url":"https://codeload.github.com/therayvoice/ray-fs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/therayvoice%2Fray-fs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33271587,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-20T15:12:43.734Z","status":"ssl_error","status_checked_at":"2026-05-20T15:12:42.300Z","response_time":356,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["chainable-methods","filesystem","fs","hacktoberfest","nodejs","synchronous"],"created_at":"2025-03-18T14:34:38.460Z","updated_at":"2026-05-20T19:09:07.266Z","avatar_url":"https://github.com/therayvoice.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ray-fs\nA library with easy to use, mind blowing file-system tools for NodeJS. Based on FS! with chainable methods, sync first approach, and amazing UX.\n\n# Installation\nTo install with NPM use:\n```\nnpm i ray-fs --save\n```\n\nThen attach it to your file using:\n```javascript\nconst fs = require('ray-fs');\n\n// use code here\n```\n\n# Usage\nThe ray-fs library has the following methods and properties:\n1. .value: To return the output of the previous method in the chain.\n\nFor example:-\n```javascript\nfs\n  .lsDir() // gets the list of Directories\n  .value // returns the list of Directories\n```\n\n2. .logVal(): To `console.log()` the output of the previous method in chain.\nFor example:-\n```javascript\nfs\n  .lsFile() // gets the list of Files\n  .logVal() // logs the list of Files\n```\n\n3. .cd(dirName): To change the \"working-directory\" to `dirName`. A virtual version of shell's `cd`, it does not allow a movement to directories deeper then depth=1. \n\n4. .ls(): To get a list of all the Files in the \"working-directory\".\n\n5. .exists(fileURL): To check if a FS item (like a File) exists at `fileURL`.\n\n6. .isFile(fileURL): To check if `fileURL` is a File or not! (a Directory maybe)\n\n7. .isDir(dirURL): To check if `dirURL` is a Direcotry or not!\n\n8. .lsMatches(filterFunction): To get a list of all items in the \"working-directory\" that matches `filterFunction`.\n\n```javascript\nfs\n  // To get a list of all items in the \"working-directory\" that have names ending in \".js\"\n  .lsMatches(item =\u003e /.js$/.test(item))\n  .value // To return that list\n```\n\nBetter written as:\n\n```javascript\nfs\n  // To get a list of all Javascript Files in the \"working-directory\"\n  .lsMatches(item =\u003e fs.isFile(item).value \u0026\u0026 /.js$/.test(item))\n  .value // To return that list\n```\n\n9. .lsDir(): To get a list of all Directories in the \"working-directory\".\n\n10. .lsFile(): To get a list of all Files in the \"working-directory\".\n\n11. .version(): To get the current version of `ray-fs`.\n\n12. .write(fileURL, content): To write the `content` into the file at `fileURL`.\n\n13. .read(fileURL).value: To read the content of the file at `fileURL`. The path used must be relative from the root directory of your project, e.g. \"./README.md\".\n\n14. .writeJSON(fileURL, json): To write the `json` into the file at `fileURL`.\n\n15. .readJSON(fileURL).value: To read/import the JSON content of the file at `fileURL`.\n\n16. .updateJSON(file, callback): TO update the json object in a .json file. For example:\n```javascript\nconst fs = require('ray-fs');\n\nconst file = \"june.json\";\nfs\n  .updateJSON(file, (json) =\u003e {\n    json.oldProp = \"replace old prop's value with new value\"; \n    json.newProp = \"adds a new prop with a new value\";\n    return json;\t\n  });\n\n```\n\n17. .readArray(fileURL).value: To read/import the content of the file at `fileURL` as an Array of lines of content.\n\n18. .push(fileURL, content): To add the `content` below the existing content of the file at `fileURL`.\n\n19. .rm(url):  To delete the item at `url`.\n\n20. .cp(url, destinationURL): To copy the item at `url` to `destinationURL`.\n\n21. .mv(url, destinationURL): To move the item at `url` to `destinationURL`.\n\n22. .mkdir(dirName): To create a new Directory named `dirName`.\n\n23. .logDir(): To log the name of the \"working-directory\".\n\n24. .validFileName(fileName): To check if a file name complies with the file naming rules. (beta version)\n\n25. .validDirName(dirName): To check if a directory name complies with the naming rules. (beta version)\n\n26. .stream(responseBody, filePath, errorCallback, sucessCallback): To pipe a `response.body` to a `filePath`.\n\n27. .initDir(dirName): To check if a directory exists, if no then create it.\n\n28. .initDirs(dirName1, dirName2, ...): To check if all of the provided directories exist, if any don't then create them.\n\n29. .initFile(fileName, fileContent): To check if a file exists, if no then create it, then add the provided `fileContent` to it. The `fileContent` paremeter can be passed a JSON `object` or a `String`.\n\nNote: The documentation is incomplete, and will be completed soon.\n\n## Chaining Functions\nChain functions to make code more readable!\n\n```javascript\nconst fs = require('ray-fs');\n\nfs\n  .mkdir('myProject')\n  .cd('myProject')\n  .write('myFile.txt', 'Hello World!')\n  .cp('myFile.txt', 'myGreeting.txt')\n  .read('myFile.txt')\n  .logVal()\n  .read('myGreeting.txt')\n  .logVal()\n\n```\nThe .value prop and the .\n\n\n## Tips\n1. Absolute URL's aren't allowed, instead use .cd() to change the \"working-directory\" first!\n2. Chain for the betterment of code, don't chain where it dosen't make sense.\n3. This library is not meant to replace `fs`, it is meant to be an alternative way to write code that can also be written with `fs`. This library will allow you to write significaltly shorter and clearer code.\n\n# Comming Soon\n1. Async methods.\n2. color logs.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftherayvoice%2Fray-fs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftherayvoice%2Fray-fs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftherayvoice%2Fray-fs/lists"}