{"id":21331424,"url":"https://github.com/eibens/wsfs","last_synced_at":"2026-04-29T14:02:49.819Z","repository":{"id":62422133,"uuid":"377418823","full_name":"eibens/wsfs","owner":"eibens","description":"WebSocket server (ws) that broadcasts file system (fs) events to its clients.","archived":false,"fork":false,"pushed_at":"2021-06-23T19:29:14.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-27T00:11:23.897Z","etag":null,"topics":["deno","events","fs","server","typescript","web","websocket"],"latest_commit_sha":null,"homepage":"","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/eibens.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-16T08:05:00.000Z","updated_at":"2021-06-23T19:29:16.000Z","dependencies_parsed_at":"2022-11-01T17:31:25.592Z","dependency_job_id":null,"html_url":"https://github.com/eibens/wsfs","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/eibens/wsfs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eibens%2Fwsfs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eibens%2Fwsfs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eibens%2Fwsfs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eibens%2Fwsfs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eibens","download_url":"https://codeload.github.com/eibens/wsfs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eibens%2Fwsfs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260927810,"owners_count":23084098,"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":["deno","events","fs","server","typescript","web","websocket"],"created_at":"2024-11-21T22:33:01.412Z","updated_at":"2026-04-29T14:02:44.764Z","avatar_url":"https://github.com/eibens.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [wsfs]\n\n\u003e [wsfs] starts a WebSocket server (ws) that broadcasts file system (fs) events\n\u003e to its clients. It is implemented in TypeScript for [Deno].\n\n[![License][license-shield]](LICENSE) [![Deno doc][deno-doc-shield]][deno-doc]\n[![Deno module][deno-land-shield]][deno-land]\n[![Github tag][github-shield]][github] [![Build][build-shield]][build]\n[![Code coverage][coverage-shield]][coverage]\n\n# Motivation\n\nFor developing websites or web-based applications, it can sometimes be useful if\none can use the web-browser to access information from a file system. For\nexample, an automatic reload can be triggered when source files change, or a\nfile listing can be updated when new files are added in a cloud storage app.\nThere is no native API that allows a web-browser to watch a file system. [wsfs]\nimplements a protocol for collecting and broadcasting that information to\nclients. Building on the WebSocket protocol further guarantees that updates can\nbe delivered quickly and frequently.\n\n# Scenarios\n\n- You are developing a website in a source code editor. In order to see the\n  changes, you have to manually reload the website in the web-browser. By\n  running `wsfs` in the directory and listening to the WebSocket server in a\n  `\u003cscript\u003e` element, automatic reloads can be triggered after every change.\n- You are deploying a web app that allows users to upload files to a shared\n  folder. The users have to reload the file listing to see whether another user\n  has changed the contents of the folder. By running `wsfs` on the server users\n  can be notified automatically.\n\n# [cli.ts]\n\nThe CLI serves as (1) a convenient way of using [wsfs] in practice, and (2) as\nan application example for [mod.ts]. Usage and installation instructions can be\nprinted in a terminal with [deno]:\n\n```sh\ndeno run https://deno.land/x/wsfs/cli.ts --help\n```\n\n# [serve.ts]\n\nThe `serve` function returns a `Server` object. If successful, it starts two\nprocesses: (1) the WebSocket server and (2) the file watcher. Both can be shut\ndown with the `Server.close` function:\n\n```ts\nimport { serve, Server } from \"https://deno.land/x/wsfs/serve.ts\";\n\n// Start server.\nconst server: Server = serve();\n\n// Print server URL.\nconsole.log(server.url);\n\n// Shut down the server at some point.\nawait server.close();\n```\n\nA `ServeOptions` object can be specified to configure the server. All entries\nare optional:\n\n```ts\nimport { Event, serve, ServeOptions } from \"./serve.ts\";\n\nconst options: ServeOptions = {\n  // Default settings for starting the server at: ws://localhost:1234\n  hostname: \"localhost\",\n  port: 1234,\n\n  // Specify the path to observe.\n  path: \".\",\n\n  // Handle server events.\n  handle: (e: Event) =\u003e console.log(e),\n};\n\nconst server = serve(options);\nawait server.close();\n```\n\n# That's it!\n\n[wsfs on GitHub][github]\n\n[wsfs]: #\n[eibens/wsfs on GitHub]: https://github.com/eibens/wsfs\n[cli.ts]: cli.ts\n[serve.ts]: serve.ts\n[deno]: https://deno.land\n\n\u003c!-- badges --\u003e\n\n[github]: https://github.com/eibens/wsfs\n[github-shield]: https://img.shields.io/github/v/tag/eibens/wsfs?label\u0026logo=github\n[coverage-shield]: https://img.shields.io/codecov/c/github/eibens/wsfs?logo=codecov\u0026label\n[license-shield]: https://img.shields.io/github/license/eibens/wsfs?color=informational\n[coverage]: https://codecov.io/gh/eibens/wsfs\n[build]: https://github.com/eibens/wsfs/actions/workflows/ci.yml\n[build-shield]: https://img.shields.io/github/workflow/status/eibens/wsfs/ci?logo=github\u0026label\n[deno-doc]: https://doc.deno.land/https/deno.land/x/wsfs/mod.ts\n[deno-doc-shield]: https://img.shields.io/badge/doc-informational?logo=deno\n[deno-land]: https://deno.land/x/wsfs\n[deno-land-shield]: https://img.shields.io/badge/x/wsfs-informational?logo=deno\u0026label\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feibens%2Fwsfs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feibens%2Fwsfs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feibens%2Fwsfs/lists"}