{"id":40697856,"url":"https://github.com/eslym/node-fastcgi","last_synced_at":"2026-01-21T11:39:40.934Z","repository":{"id":158567332,"uuid":"634044596","full_name":"eslym/node-fastcgi","owner":"eslym","description":"FastCGI implementation for Node.js","archived":false,"fork":false,"pushed_at":"2024-04-17T21:10:46.000Z","size":111,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-23T20:53:53.851Z","etag":null,"topics":["fastcgi","nodejs"],"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/eslym.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}},"created_at":"2023-04-28T22:24:14.000Z","updated_at":"2024-04-20T19:33:24.000Z","dependencies_parsed_at":"2023-07-06T14:01:52.151Z","dependency_job_id":null,"html_url":"https://github.com/eslym/node-fastcgi","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/eslym/node-fastcgi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eslym%2Fnode-fastcgi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eslym%2Fnode-fastcgi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eslym%2Fnode-fastcgi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eslym%2Fnode-fastcgi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eslym","download_url":"https://codeload.github.com/eslym/node-fastcgi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eslym%2Fnode-fastcgi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28632773,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T04:47:28.174Z","status":"ssl_error","status_checked_at":"2026-01-21T04:47:22.943Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["fastcgi","nodejs"],"created_at":"2026-01-21T11:39:40.433Z","updated_at":"2026-01-21T11:39:40.926Z","avatar_url":"https://github.com/eslym.png","language":"TypeScript","readme":"# node-fastcgi\n\nAn implementation of [fastcgi protocol](https://fast-cgi.github.io/) for NodeJS\n\n```shell\nnpm i @eslym/fastcgi\n```\n\n```shell\nyarn add @eslym/fastcgi\n```\n\n## Usage\n\n### Simple Usage\n\n```typescript\nimport { Server } from '@eslym/fastcgi';\n\nconst server = new Server({\n    fastcgi: {\n        FCGI_MAX_CONNS: 10,\n        FCGI_MAX_REQS: 50,\n        FCGI_MPXS_CONNS: true\n    }\n});\n\nasync function writeAsync(stream, data) {\n    return new Promise((resolve, reject) =\u003e {\n        stream.write(data, (err) =\u003e {\n            if (err) {\n                reject(err);\n            } else {\n                resolve();\n            }\n        });\n    });\n}\n\nserver.on('request', async (req) =\u003e {\n    console.log(req.params);\n    try {\n        await writeAsync(req.stdout, 'Status: 200\\r\\n');\n        await writeAsync(req.stdout, 'Content-Type: text/plain\\r\\n');\n        await writeAsync(req.stdout, 'Content-Length: 12\\r\\n\\r\\n');\n        await writeAsync(req.stdout, 'Hello World!');\n        req.stdout.end();\n        req.end(0);\n    } catch (e) {\n        console.error(e);\n    }\n});\n\nserver.on('error', (err) =\u003e {\n    console.error(err);\n});\n\nserver.listen(9000);\n```\n\n### HTTP Helper\n\n```typescript\nimport { Server, handleHttp } from '@eslym/fastcgi';\n\nconst server = new Server({\n    fastcgi: {\n        FCGI_MAX_CONNS: 10,\n        FCGI_MAX_REQS: 50,\n        FCGI_MPXS_CONNS: true\n    }\n});\n\nasync function readAsync(stream) {\n    return new Promise((resolve, reject) =\u003e {\n        let data: Buffer[] = [];\n        stream.on('data', (chunk) =\u003e {\n            data.push(chunk);\n        });\n        stream.on('end', () =\u003e {\n            resolve(Buffer.concat(data));\n        });\n        stream.on('error', (err) =\u003e {\n            reject(err);\n        });\n    });\n}\n\nserver.on('request', (request) =\u003e {\n    console.log('FastCGI Params', request.params);\n    handleHttp(async (req, res) =\u003e {\n        console.log('HTTP Headers', req.headers);\n        if (req.headers['content-length'] !== '0') {\n            const body = await readAsync(req);\n            console.log('HTTP Body', body.toString());\n        }\n        res.writeHead(200, {\n            'Content-Type': 'text/plain'\n        });\n        res.end('Hello World');\n    })(request);\n});\n\nserver.on('error', (err) =\u003e {\n    console.error(err);\n});\n\nserver.listen(9000);\n```\n\n### Use as a client\n\n```typescript\nimport { OutgoingConnection } from '@eslym/fastcgi';\nimport { connect } from 'net';\n\nconst socket = connect(9000);\n\nsocket.on('connect', async () =\u003e {\n    const conn = new OutgoingConnection(socket);\n\n    const req = await conn.beginRequest(\n        {\n            QUERY_STRING: '',\n            REQUEST_METHOD: 'GET',\n            CONTENT_TYPE: '',\n            CONTENT_LENGTH: '0',\n            SCRIPT_FILENAME: '/var/www/html/index.php',\n            SCRIPT_NAME: '/index.php',\n            REQUEST_URI: '/',\n            DOCUMENT_URI: '/index.php',\n            DOCUMENT_ROOT: '/var/www/html',\n            PATH_INFO: '',\n            PATH_TRANSLATED: '',\n            SERVER_PROTOCOL: 'HTTP/1.1',\n            GATEWAY_INTERFACE: 'CGI/1.1',\n            SERVER_SOFTWARE: 'nodejs',\n            REMOTE_ADDR: '127.0.0.1',\n            REMOTE_PORT: '12345',\n            SERVER_ADDR: '127.0.0.1',\n            SERVER_PORT: '80',\n            SERVER_NAME: 'localhost',\n            HTTP_HOST: 'www.example.com',\n            HTTP_USER_AGENT: 'nodejs',\n            HTTP_ACCEPT: '*/*',\n            HTTP_ACCEPT_LANGUAGE: 'en-US'\n        },\n        {\n            keepAlive: true\n        }\n    );\n\n    let buffer = [];\n\n    req.stdout.on('data', (chunk) =\u003e {\n        buffer.push(chunk);\n    });\n\n    req.on('end', (status) =\u003e {\n        console.log(Buffer.concat(buffer).toString());\n        console.log(`Request end with status ${status}`);\n    });\n});\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feslym%2Fnode-fastcgi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feslym%2Fnode-fastcgi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feslym%2Fnode-fastcgi/lists"}