{"_id":"semaphore","_rev":"26-3eb3dd597e9eab78513d6cad03c17c8a","name":"semaphore","description":"semaphore for node","dist-tags":{"latest":"1.1.0"},"versions":{"1.0.0":{"name":"semaphore","version":"1.0.0","description":"semaphore for node","engine":"node >= 0.6.0","main":"./lib/semaphore.js","dependencies":{},"devDependencies":{"mocha":"1.0.x","should":"0.6.x"},"homepage":"https://github.com/abrkn/semaphore.js","_npmUser":{"name":"abrkn","email":"andreas@opuno.com"},"_id":"semaphore@1.0.0","optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.16","_nodeVersion":"v0.6.15","_defaultsLoaded":true,"dist":{"shasum":"a9703f9334f4caf18d97c2874bde0f441bf7bca2","tarball":"https://registry.npmjs.org/semaphore/-/semaphore-1.0.0.tgz","integrity":"sha512-WrOOzqykkEEXmeGyEdM/HKQC6aga41AuAEfo2hcAFpuF+XCay94zuEVwVaH876T2h4nquroenSQZvj/aZdWlQA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBb3DM5KFQQvVheAid55zOccF+Zv3nrO9lUiARs1peaAAiARAuIyWCbrSvWJ3qSHRkoBUnGLp2GjlPlVIm6euPw2RA=="}]},"maintainers":[{"name":"abrkn","email":"andreas@opuno.com"}]},"1.0.1":{"name":"semaphore","version":"1.0.1","description":"semaphore for node","engine":"node >= 0.6.0","main":"./lib/semaphore.js","dependencies":{},"devDependencies":{"mocha":"1.0.x","should":"0.6.x"},"homepage":"https://github.com/abrkn/semaphore.js","_id":"semaphore@1.0.1","dist":{"shasum":"74e3181df4cba653d20d5b0ab04a78efc2cf83ea","tarball":"https://registry.npmjs.org/semaphore/-/semaphore-1.0.1.tgz","integrity":"sha512-9njComwRiuw5+PcL6lFyCRkh7WXLPQox7pbtm+Z03X07iK6ktO1Lrb3wJcqHoVpgZMNXm/BvLKMySwJJwBk56Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCaYO0G3Xi+TIVM2YWqP8hXuWWcJShZKXII5YxgtuEeTQIhANhdV/Do/2LiO2m13y7rwLXV8uceGSWXzmCJz2WhGe7j"}]},"_npmVersion":"1.1.65","_npmUser":{"name":"abrkn","email":"a@abrkn.com"},"maintainers":[{"name":"abrkn","email":"andreas@opuno.com"}]},"1.0.2":{"name":"semaphore","version":"1.0.2","description":"semaphore for node","engine":"node >= 0.6.0","main":"./lib/semaphore.js","dependencies":{},"devDependencies":{"mocha":"1.0.x","should":"0.6.x"},"homepage":"https://github.com/abrkn/semaphore.js","repository":{"type":"git","url":"git@github.com:abrkn/semaphore.js.git"},"scripts":{"test":"mocha"},"gitHead":"fe309c4ae083099675cc0013ca83808f347e8ed6","bugs":{"url":"https://github.com/abrkn/semaphore.js/issues"},"_id":"semaphore@1.0.2","_shasum":"5da5e45359acb5268818a3221665b3818e35c5c7","_from":".","_npmVersion":"2.7.1","_nodeVersion":"1.6.2","_npmUser":{"name":"abrkn","email":"a@abrkn.com"},"maintainers":[{"name":"abrkn","email":"andreas@opuno.com"}],"dist":{"shasum":"5da5e45359acb5268818a3221665b3818e35c5c7","tarball":"https://registry.npmjs.org/semaphore/-/semaphore-1.0.2.tgz","integrity":"sha512-mRhRmLgR557QaZXQuEap6+4WJIR+qDu5hu5IIuAKpFwaZkKZiZe5DeurT+enLnSkm2g0fyl+e478QPToWJVV+w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCsXEcmuFtMABG5bWy75VA7fzAOMusTXqmoDc1RbRwiqwIhAPSIMdC5vXJo+csCTLgD7bca87Bg3uShLz0v2CZ8Hw2M"}]}},"1.0.3":{"name":"semaphore","version":"1.0.3","description":"semaphore for node","engine":"node >= 0.6.0","main":"./lib/semaphore.js","dependencies":{},"devDependencies":{"mocha":"2.2.x","should":"6.0.x"},"homepage":"https://github.com/abrkn/semaphore.js","repository":{"type":"git","url":"git@github.com:abrkn/semaphore.js.git"},"scripts":{"test":"mocha"},"gitHead":"a50de37da48aeafd580b8f283710cdca81d0bae1","bugs":{"url":"https://github.com/abrkn/semaphore.js/issues"},"_id":"semaphore@1.0.3","_shasum":"77dfc0180ebe7074b5176e7d64be5ef75d69736c","_from":".","_npmVersion":"1.4.23","_npmUser":{"name":"sqrt","email":"sqrt@entless.org"},"maintainers":[{"name":"abrkn","email":"andreas@opuno.com"},{"name":"sqrt","email":"sqrt@entless.org"}],"dist":{"shasum":"77dfc0180ebe7074b5176e7d64be5ef75d69736c","tarball":"https://registry.npmjs.org/semaphore/-/semaphore-1.0.3.tgz","integrity":"sha512-ElWkuXNGfPW0QrynpjPyONcYiV7i5mNDWHrfxNPHnnTzHY0rqXq/3kfKWX7B0m04GJKmiNRK6d5lIBQfnLvlRA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCRMYQCQ6s5tgXlJtkmiv8z9al31KIoeQiuknAdjGseHQIhAPkyNfoJ8bHP0eLXORK5kNMWqx4RAOzD5Y8xXqa98WHl"}]}},"1.0.4":{"name":"semaphore","version":"1.0.4","description":"semaphore for node","engines":{"node":">=0.8.0"},"main":"./lib/semaphore.js","dependencies":{},"devDependencies":{"mocha":"2.x.x","should":"8.x.x"},"homepage":"https://github.com/abrkn/semaphore.js","repository":{"type":"git","url":"git+ssh://git@github.com/abrkn/semaphore.js.git"},"scripts":{"test":"mocha"},"gitHead":"bfcf35defab1e0f7040c16a08f0f7f1f32770214","bugs":{"url":"https://github.com/abrkn/semaphore.js/issues"},"_id":"semaphore@1.0.4","_shasum":"1f45e3075b2253d515a960a2a408360a39c267a8","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.2","_npmUser":{"name":"abrkn","email":"a@abrkn.com"},"maintainers":[{"name":"abrkn","email":"andreas@opuno.com"},{"name":"sqrt","email":"sqrt@entless.org"}],"dist":{"shasum":"1f45e3075b2253d515a960a2a408360a39c267a8","tarball":"https://registry.npmjs.org/semaphore/-/semaphore-1.0.4.tgz","integrity":"sha512-NYDa0jCbN595n1QsrON82C7mgWOScP5Is+mvYCxLyV4JQaPcmNvElqZjPxCIMoViwVeDbWu9AWTE9dYR1/xiVg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDfLwheeWJzh3PrZAtVehpMa25nzOKxr944xHOe3/vFwAIhALS6N1UIHqx0O9caTWdRRyz/kvBmBYdrSFZgeHs96hOu"}]},"_npmOperationalInternal":{"host":"packages-6-west.internal.npmjs.com","tmp":"tmp/semaphore-1.0.4.tgz_1455825800956_0.21430362574756145"}},"1.0.5":{"name":"semaphore","version":"1.0.5","description":"semaphore for node","engines":{"node":">=0.8.0"},"main":"./lib/semaphore.js","dependencies":{},"devDependencies":{"mocha":"2.x.x","should":"8.x.x"},"homepage":"https://github.com/abrkn/semaphore.js","repository":{"type":"git","url":"git+ssh://git@github.com/abrkn/semaphore.js.git"},"scripts":{"test":"mocha"},"gitHead":"4b7471c5efc348b3279621e58e0b47b55ac60040","bugs":{"url":"https://github.com/abrkn/semaphore.js/issues"},"_id":"semaphore@1.0.5","_shasum":"b492576e66af193db95d65e25ec53f5f19798d60","_from":".","_npmVersion":"3.3.12","_nodeVersion":"6.0.0-pre","_npmUser":{"name":"sqrt","email":"sqrt@entless.org"},"maintainers":[{"name":"abrkn","email":"andreas@opuno.com"},{"name":"sqrt","email":"sqrt@entless.org"}],"dist":{"shasum":"b492576e66af193db95d65e25ec53f5f19798d60","tarball":"https://registry.npmjs.org/semaphore/-/semaphore-1.0.5.tgz","integrity":"sha512-15WnK4TxpOk33fL0UoDnJ5myIWwJiodIZHtPRBoSxcaADt1Tm7kxEERd8n0vsw6OWsXwCCeROjSKU9MqfHaS1A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDT5a+93DuVFx3YYMdkrBiDHvpJ3tBf2J2XXpTi6rtLYAiAXAMBwBRNNhQZTLIQnznRFWAWKxSldi3prdkbF1bMVSQ=="}]},"_npmOperationalInternal":{"host":"packages-9-west.internal.npmjs.com","tmp":"tmp/semaphore-1.0.5.tgz_1456608578363_0.32074872963130474"}},"1.1.0":{"name":"semaphore","version":"1.1.0","description":"semaphore for node","engines":{"node":">=0.8.0"},"main":"./lib/semaphore.js","dependencies":{},"devDependencies":{"mocha":"2.x.x","should":"8.x.x"},"homepage":"https://github.com/abrkn/semaphore.js","repository":{"type":"git","url":"git+ssh://git@github.com/abrkn/semaphore.js.git"},"scripts":{"test":"mocha"},"gitHead":"88a33875b168cc7b5943d7fe987c36d08321d252","bugs":{"url":"https://github.com/abrkn/semaphore.js/issues"},"_id":"semaphore@1.1.0","_npmVersion":"5.3.0-canary.0","_nodeVersion":"9.0.0-pre","_npmUser":{"name":"addaleax","email":"anna@addaleax.net"},"dist":{"integrity":"sha512-O4OZEaNtkMd/K0i6js9SL+gqy0ZCBMgUvlSqHKi4IBdjhe7wB8pwztUk1BbZ1fmrvpwFrPbHzqd2w5pTcJH6LA==","shasum":"aaad8b86b20fe8e9b32b16dc2ee682a8cd26a8aa","tarball":"https://registry.npmjs.org/semaphore/-/semaphore-1.1.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDc03DwOnVx7li+F63zybiar7S0vDvbb7jdV8wKR3GBaAIgY0We5IeBEbXjIn3vLlsE8sHGXhkZ6o0xNnQCYN6o2X8="}]},"maintainers":[{"email":"anna@addaleax.net","name":"addaleax"},{"email":"a@abrkn.com","name":"abrkn"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/semaphore-1.1.0.tgz_1502209343262_0.5487388467881829"}}},"readme":"semaphore.js\n============\n\n[![Build Status](https://travis-ci.org/abrkn/semaphore.js.svg?branch=master)](https://travis-ci.org/abrkn/semaphore.js)\n\nInstall:\nnpm install semaphore\n\nLimit simultaneous access to a resource.\n\n```javascript\n// Create\nvar sem = require('semaphore')(capacity);\n\n// Take\nsem.take(fn[, n=1])\nsem.take(n, fn)\n\n// Leave\nsem.leave([n])\n\n// Available\nsem.available([n])\n```\n\n\n```javascript\n// Limit concurrent db access\nvar sem = require('semaphore')(1);\nvar server = require('http').createServer(req, res) {\n\tsem.take(function() {\n\t\texpensive_database_operation(function(err, res) {\n\t\t\tsem.leave();\n\n\t\t\tif (err) return res.end(\"Error\");\n\n\t\t\treturn res.end(res);\n\t\t});\n\t});\n});\n```\n\n```javascript\n// 2 clients at a time\nvar sem = require('semaphore')(2);\nvar server = require('http').createServer(req, res) {\n\tres.write(\"Then good day, madam!\");\n\n\tsem.take(function() {\n\t\tres.end(\"We hope to see you soon for tea.\");\n\t\tsem.leave();\n\t});\n});\n```\n\n```javascript\n// Rate limit\nvar sem = require('semaphore')(10);\nvar server = require('http').createServer(req, res) {\n\tsem.take(function() {\n\t\tres.end(\".\");\n\t\t\n\t\tsetTimeout(sem.leave, 500)\n\t});\n});\n```\n\nLicense\n===\n\nMIT\n","maintainers":[{"email":"anna@addaleax.net","name":"addaleax"},{"email":"andreas@brekken.com","name":"abrkn"}],"time":{"modified":"2022-06-26T17:31:19.146Z","created":"2012-05-25T08:24:18.558Z","1.0.0":"2012-05-25T08:24:21.263Z","1.0.1":"2012-11-05T12:43:20.133Z","1.0.2":"2015-04-01T07:58:29.412Z","1.0.3":"2015-06-11T02:29:38.204Z","1.0.4":"2016-02-18T20:03:23.362Z","1.0.5":"2016-02-27T21:29:41.335Z","1.1.0":"2017-08-08T16:22:24.146Z"},"users":{"fgribreau":true,"barwin":true,"ysden123":true,"swizard":true,"lexon":true,"haroun":true},"homepage":"https://github.com/abrkn/semaphore.js","readmeFilename":"README.md","repository":{"type":"git","url":"git+ssh://git@github.com/abrkn/semaphore.js.git"},"bugs":{"url":"https://github.com/abrkn/semaphore.js/issues"}}