{"id":13686683,"url":"https://github.com/fibjs/fib-pool","last_synced_at":"2025-08-11T15:08:31.207Z","repository":{"id":57235125,"uuid":"79781922","full_name":"fibjs/fib-pool","owner":"fibjs","description":"Generic resource pooling for fibjs","archived":false,"fork":false,"pushed_at":"2020-06-10T14:01:34.000Z","size":48,"stargazers_count":2,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-09T06:21:14.319Z","etag":null,"topics":["database","pool"],"latest_commit_sha":null,"homepage":null,"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/fibjs.png","metadata":{"files":{"readme":"Readme.md","changelog":"CHANGELOG.md","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":"2017-01-23T07:46:39.000Z","updated_at":"2020-06-10T14:01:37.000Z","dependencies_parsed_at":"2022-08-23T16:30:19.789Z","dependency_job_id":null,"html_url":"https://github.com/fibjs/fib-pool","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/fibjs/fib-pool","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fibjs%2Ffib-pool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fibjs%2Ffib-pool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fibjs%2Ffib-pool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fibjs%2Ffib-pool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fibjs","download_url":"https://codeload.github.com/fibjs/fib-pool/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fibjs%2Ffib-pool/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269706643,"owners_count":24462205,"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-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":["database","pool"],"created_at":"2024-08-02T15:00:37.846Z","updated_at":"2025-08-11T15:08:31.171Z","avatar_url":"https://github.com/fibjs.png","language":"JavaScript","funding_links":[],"categories":["Packages"],"sub_categories":["Server App"],"readme":"## Generic resource pooling for fibjs\n\n[![NPM version](https://img.shields.io/npm/v/fib-pool.svg)](https://www.npmjs.org/package/fib-pool)\n[![Build Status](https://travis-ci.org/fibjs/fib-pool.svg)](https://travis-ci.org/fibjs/fib-pool)\n[![Build status](https://ci.appveyor.com/api/projects/status/p662f7ulpc4asu8s?svg=true)](https://ci.appveyor.com/project/richardo2016/fib-pool)\n\n## Install\n\n```sh\nnpm install fib-pool [--save]\n```\n\n## Test\n\n```sh\nnpm run ci\n```\n\n## Creating a pool\n\nSimple example.\n\n```js\nvar db = require(\"db\");\nvar Pool = require(\"fib-pool\");\n\nvar p = Pool(() =\u003e {\n    return db.open(\"sqlite:test.db\");\n});\n```\n\nSpecify maxsize and timeout.\n\n```js\nvar db = require(\"db\");\nvar Pool = require(\"fib-pool\");\n\nvar p = Pool(() =\u003e {\n    return db.open(\"sqlite:test.db\");\n}, 10, 30 * 1000);\n```\n\nSpecify custom destroy function.\n\n```js\nvar db = require(\"db\");\nvar Pool = require(\"fib-pool\");\n\nvar p = Pool({\n    create: () =\u003e {\n        return db.open(\"sqlite:test.db\");\n    },\n    destroy: (o) =\u003e {\n        o.close()\n    },\n    timeout: 30 * 1000,\n    retry: 3\n});\n```\n\n## Using the pool\n\n```js\nvar db = require(\"db\");\nvar Pool = require(\"fib-pool\");\n\nvar p = Pool({\n    create: () =\u003e {\n        return db.open(\"sqlite:test.db\");\n    },\n    destroy: (o) =\u003e {\n        o.close()\n    },\n    timeout: 30 * 1000,\n    retry: 3\n});\n\nvar res = p((conn) =\u003e {\n    conn.execute(\"select * from test\");\n});\n\n```\n\n## Using the pool with name\n\n```js\nvar db = require(\"db\");\nvar Pool = require(\"fib-pool\");\n\nvar p = Pool({\n    create: (name) =\u003e {\n        return db.open(\"sqlite:\" + name + \".db\");\n    },\n    destroy: (o) =\u003e {\n        o.close()\n    },\n    timeout: 30 * 1000\n});\n\nvar res = p(\"test\", (conn) =\u003e {\n    conn.execute(\"select * from test\");\n});\n\n```\n\n## Clear a pool\n\nSimple example.\n\n```js\nvar db = require(\"db\");\nvar Pool = require(\"fib-pool\");\n\nvar p = Pool(() =\u003e {\n    return db.open(\"sqlite:test.db\");\n});\n\np.clear();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffibjs%2Ffib-pool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffibjs%2Ffib-pool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffibjs%2Ffib-pool/lists"}