{"id":15578185,"url":"https://github.com/coderaiser/join-io","last_synced_at":"2025-04-05T22:09:15.139Z","repository":{"id":19697802,"uuid":"22952614","full_name":"coderaiser/join-io","owner":"coderaiser","description":"join files on a fly to reduce requests count","archived":false,"fork":false,"pushed_at":"2021-01-25T18:34:17.000Z","size":52,"stargazers_count":81,"open_issues_count":0,"forks_count":2,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-29T21:07:39.117Z","etag":null,"topics":["cloudcmd","express","express-middleware","javascript","nodejs"],"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/coderaiser.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog","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":"2014-08-14T12:20:44.000Z","updated_at":"2025-03-10T10:42:59.000Z","dependencies_parsed_at":"2022-08-05T05:00:18.793Z","dependency_job_id":null,"html_url":"https://github.com/coderaiser/join-io","commit_stats":null,"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderaiser%2Fjoin-io","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderaiser%2Fjoin-io/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderaiser%2Fjoin-io/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderaiser%2Fjoin-io/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coderaiser","download_url":"https://codeload.github.com/coderaiser/join-io/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247406091,"owners_count":20933803,"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":["cloudcmd","express","express-middleware","javascript","nodejs"],"created_at":"2024-10-02T19:07:11.917Z","updated_at":"2025-04-05T22:09:15.101Z","avatar_url":"https://github.com/coderaiser.png","language":"JavaScript","funding_links":[],"categories":["中间件"],"sub_categories":[],"readme":"# Join-io\n\nJoin files on a fly to reduce requests count.\n\n## Install\n\n`npm i join-io --save`\n\n## How it works?\n\n`join-io` it's middleware that works with streams: open files and pipe them to `response` one-by-one,\nwhen everything is done, stream is closing. `join-io` based on readPipe function of [files-io](https://github.com/coderaiser/files-io \"Files-io\").\n\n[jsDelivr](https://jsdelivr.com/ \"jsDelivr\") works in similar way: [load Multiple files with a single HTTP request](https://www.maxcdn.com/blog/jsdelivr-better/ \"load Multiple files with a single HTTP\").\n\n## How to use?\n\n`Join-io` could be used as express middleware.\n\n### Client\n\n```html\n\u003clink rel=\"/join:/css/normilize.css:/css/style.css\"\u003e\n\u003cscript src=\"/join:/lib/client.js:/lib/util.js:/lib/jquery.js\"\u003e\u003c/script\u003e\n```\n\n#### Join.js\n\nYou could build join urls dynamically. Load `/join/join.js` library for this purpose.\n\n```html\n\u003cscript src=\"/join/join.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n    join(['lib/client', 'lib/util.js']);\n\u003c/script\u003e\n```\n\nTo decrease requests count you could make `/join/join.js` part of request:\n\n```html\n\u003cscript src=\"/join:/lib/client.js:/lib/util.js:/join/join.js\"\u003e\u003c/script\u003e\n```\n\nInstead of `/join` you could use any prefix you like (don't forget to set it on the server side).\n\n### Server\n\n```js\nconst join = require('join-io');\nconst http = require('http');\nconst express = require('express');\n\nconst app = express();\nconst server = http.createServer(app);\n\nconst port = 1337;\nconst ip = '0.0.0.0';\n\napp.use(join({\n    dir: __dirname,\n    prefix: '/join',    /* default */\n}));\n\napp.use(express.static(__dirname));\n\nserver.listen(port, ip);\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderaiser%2Fjoin-io","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoderaiser%2Fjoin-io","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderaiser%2Fjoin-io/lists"}