{"id":16125509,"url":"https://github.com/semibran/fs-tree","last_synced_at":"2025-07-22T17:34:52.102Z","repository":{"id":57139846,"uuid":"123411538","full_name":"semibran/fs-tree","owner":"semibran","description":":evergreen_tree: speedy recursive reads and writes for simple file system trees","archived":false,"fork":false,"pushed_at":"2020-10-19T00:36:57.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-14T14:50:42.166Z","etag":null,"topics":["file-system","filesystem","fs","recursive","tree"],"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/semibran.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":"2018-03-01T09:19:21.000Z","updated_at":"2020-10-19T00:37:00.000Z","dependencies_parsed_at":"2022-09-05T01:11:22.925Z","dependency_job_id":null,"html_url":"https://github.com/semibran/fs-tree","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/semibran/fs-tree","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semibran%2Ffs-tree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semibran%2Ffs-tree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semibran%2Ffs-tree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semibran%2Ffs-tree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/semibran","download_url":"https://codeload.github.com/semibran/fs-tree/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semibran%2Ffs-tree/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266540081,"owners_count":23945148,"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-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":["file-system","filesystem","fs","recursive","tree"],"created_at":"2024-10-09T21:29:51.824Z","updated_at":"2025-07-22T17:34:52.073Z","avatar_url":"https://github.com/semibran.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fs-tree\n\u003e speedy recursive reads and writes for simple file system trees\n\n```js\nconst { read, write } = require(\"@semibran/fs-tree\")\n\nread(src, (err, data) =\u003e {\n  if (err) throw err\n  write(dest, data, (err) =\u003e {\n    if (err) throw err\n    console.log(`copied from ${src} to ${dest}`)\n  })\n})\n```\n\n`fs-tree` provides fast recursive read and write operations for both files and folders by modelling them as strings and maps respectively. For example, consider the following folder structure:\n\n```\nfoo\n└── bar\n    ├── hello.txt\n    └── world.txt\n```\n\nIn this scenario, `read(\"foo\", callback)` might yield the following:\n\n```js\nfoo = {\n  \"bar\": {\n    \"hello.txt\": \"greetings human\",\n    \"world.txt\": \"welcome to mars\"\n  }\n}\n```\n\nFurthermore, `read(\"foo/bar/hello.txt\", callback)` would yield `\"greetings human\"`, equivalent to the output of `fs.readFile` called with the `\"utf8\"` option.\n\nNote that this module doesn't handle any kinds of links for simplicity's sake, although this property is subject to change.\n\n## usage\n[![npm badge]][npm package]\n\n### `read(path[, opts], callback(err, data))`\nReads the file or folder specified by `path` and returns its data via `callback`.\n```js\nread(path, (err, data) =\u003e {\n  if (err) throw err\n  console.log(path + \": \" + JSON.stringify(data, null, 2))\n})\n```\n\n#### opts\n- `ignore`: file names and file extensions to ignore, e.g. `[ \".git\", \".png\" ]`\n\n### `write(path, data, callback(err))`\nWrites `data` to the given path, calling `callback` upon completion.\n\n```js\nwrite(path, data, err =\u003e {\n  if (err) throw err\n  console.log(\"write successful\")\n})\n```\n\n## related\n* [`semibran/scaffy`][semibran/scaffy]: tiny project scaffolding tool\n\n[npm badge]:       https://nodei.co/npm/@semibran/fs-tree.png?mini\n[npm package]:     https://npmjs.com/package/@semibran/fs-tree\n[semibran/scaffy]: https://github.com/semibran/scaffy\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsemibran%2Ffs-tree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsemibran%2Ffs-tree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsemibran%2Ffs-tree/lists"}