{"id":16392980,"url":"https://github.com/yjl9903/breadfs","last_synced_at":"2025-03-21T02:32:22.873Z","repository":{"id":196304928,"uuid":"689718977","full_name":"yjl9903/BreadFS","owner":"yjl9903","description":"Unified File System Abstraction","archived":false,"fork":false,"pushed_at":"2025-03-13T20:49:50.000Z","size":1343,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-13T21:37:07.654Z","etag":null,"topics":["file-system","node","webdav"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/breadfs","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/yjl9903.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["yjl9903"]}},"created_at":"2023-09-10T17:34:04.000Z","updated_at":"2025-03-13T20:49:53.000Z","dependencies_parsed_at":"2023-10-10T19:07:42.312Z","dependency_job_id":"076d3851-babe-48d0-a99b-af860924f4a5","html_url":"https://github.com/yjl9903/BreadFS","commit_stats":{"total_commits":516,"total_committers":3,"mean_commits":172.0,"dds":"0.22286821705426352","last_synced_commit":"ed729298d021f8acd4775d4fef973823aaea1676"},"previous_names":["yjl9903/breadfs","yjl9903/asyncfs"],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yjl9903%2FBreadFS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yjl9903%2FBreadFS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yjl9903%2FBreadFS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yjl9903%2FBreadFS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yjl9903","download_url":"https://codeload.github.com/yjl9903/BreadFS/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244102760,"owners_count":20398386,"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":["file-system","node","webdav"],"created_at":"2024-10-11T04:52:00.998Z","updated_at":"2025-03-21T02:32:22.473Z","avatar_url":"https://github.com/yjl9903.png","language":"TypeScript","funding_links":["https://github.com/sponsors/yjl9903"],"categories":[],"sub_categories":[],"readme":"# BreadFS\n\n[![version](https://img.shields.io/npm/v/breadfs?label=breadfs)](https://www.npmjs.com/package/breadfs)\n[![CI](https://github.com/yjl9903/breadfs/actions/workflows/ci.yml/badge.svg)](https://github.com/yjl9903/breadfs/actions/workflows/ci.yml)\n\nUnified File System Abstraction.\n\n+ Frequently used **file system operation API**\n+ **Operate files across different file systems**\n+ [Node.js fs module](https://nodejs.org/api/fs.html) provider\n+ [WebDAV client](https://github.com/perry-mitchell/webdav-client) provider\n\n```ts\nimport { fs as nfs } from 'breadfs/node'\nimport { WebDAVFS } from 'breadfs/webdav'\n\n// Write something to hello.txt\nconst local = nfs.path('hello.txt')\nawait local.writeText('This is used for testing')\n\n// Create WebDAV file system\nconst wfs = WebDAVFS.make(\"https://some-server.org\", {\n  username: \"user\",\n  password: \"pass\"\n})\n\n// Copy the local hello.txt to the remote WebDAV server\nconst remote = wfs.path('/hello.txt')\nawait local.copyTo(remote)\nawait remote.readText()\n// Return 'This is used for testing'\n```\n\n## Installation\n\n```bash\nnpm i breadfs\n```\n\n\u003e **Notice**\n\u003e\n\u003e This package is built on the web native [Streams API](https://developer.mozilla.org/en-US/docs/Web/API/Streams_API). You should add `\"lib\": [\"ES2018\", \"DOM\"]` to your `tsconfig.json`.\n\n## Usage\n\n### Node\n\n```ts\nimport { fs as nfs } from 'breadfs/node'\n\nconst bin = nfs.path('/bin')\n\nawait bin.list()\nawait bin.join('node').stat()\nawait nfs.path('/home/.bashrc').readFile()\nawait nfs.path('/home/.bashrc').readText()\nawait nfs.path('/home/test.txt').writeText('This is used for testing')\n```\n\n### WebDAV\n\n```bash\nnpm i breadfs @breadfs/webdav\n```\n\n```ts\nimport { WebDAVFS } from 'breadfs/webdav'\n\nconst wfs = WebDAVFS.make(\"https://some-server.org\", {\n  username: \"user\",\n  password: \"pass\"\n})\n\nawait wfs.path('/test.txt').readText()\n```\n\n### Across different file systems\n\n```ts\nimport { fs as nfs } from 'breadfs/node'\nimport { WebDAVFS } from 'breadfs/webdav'\n\nconst wfs = WebDAVFS.make(\"https://some-server.org\", {\n  username: \"user\",\n  password: \"pass\"\n})\n\nconst local = nfs.path('hello.txt')\nconst remote = wfs.path('/hello.txt')\nawait local.writeText('This is used for testing')\nawait local.copyTo(remote)\nawait remote.readText()  // 'This is used for testing'\n```\n\nOperating files across various different file systems can be quite **challenging**, which means our implementation may **not function perfectly in all scenarios**. Even file system in your local machine may encounter some bugs.\n\nSo that the goal of this package is to provide **a straightforward abstraction and utility** for use in **less complex or basic situations**.\n\n## Related\n\nThis package is used to power [AnimeSpace](https://github.com/yjl9903/AnimeSpace), offering a comprehensive solution for automatically following bangumis. It can fetch anime resources, download desired video content, and upload them to the local file system or remote WebDAV server. The upload process is facilitated by this package.\n\n## License\n\nMIT License © 2023 [XLor](https://github.com/yjl9903)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyjl9903%2Fbreadfs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyjl9903%2Fbreadfs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyjl9903%2Fbreadfs/lists"}