{"_id":"@ntlab/sfetch","_rev":"6-3bdbbd7fc483fe838c9e6e7b1d035f2a","name":"@ntlab/sfetch","dist-tags":{"latest":"1.5.0"},"versions":{"1.0.0":{"name":"@ntlab/sfetch","version":"1.0.0","keywords":["simultaneous","fetch"],"author":{"name":"Toha","email":"tohenk@yahoo.com"},"license":"MIT","_id":"@ntlab/sfetch@1.0.0","maintainers":[{"name":"tohenk","email":"tohenk@yahoo.com"}],"homepage":"https://github.com/tohenk/node-sfetch#readme","bugs":{"url":"https://github.com/tohenk/node-sfetch/issues"},"dist":{"shasum":"1cfe1514c9a3464db910e13a57cbcd9c25b5e29a","tarball":"https://registry.npmjs.org/@ntlab/sfetch/-/sfetch-1.0.0.tgz","fileCount":5,"integrity":"sha512-AWrC43z1TncvB7S7dl9Wn8xZpCqdKFBfXqaN3BXPfJeS3gxV9Fm86eAsW95YdXTOgPWbCC/GAgVuXi6Aot6DkQ==","signatures":[{"sig":"MEUCIQDQqA48f9EiFhcd9JN5t2uevGrfngwUSbpu5XpdM2TbtwIgXU6Rc31DG1TNoT4LR+UHRCmGs1mzr7MYViHBpGTwr6U=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":15011},"main":"index.js","gitHead":"daef098fd3b2939a464a3180364abc807c7a7234","scripts":{"test":"node test.js"},"_npmUser":{"name":"tohenk","email":"tohenk@yahoo.com"},"repository":{"url":"git+https://github.com/tohenk/node-sfetch.git","type":"git"},"_npmVersion":"10.9.2","description":"Simultaneously fetch urls","directories":{},"_nodeVersion":"22.11.0","dependencies":{"axios":"^1.7.9"},"_hasShrinkwrap":false,"devDependencies":{"http-request-mock":"^2.0.2"},"_npmOperationalInternal":{"tmp":"tmp/sfetch_1.0.0_1734515769573_0.41235818434372495","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@ntlab/sfetch","version":"1.1.0","keywords":["simultaneous","fetch"],"author":{"name":"Toha","email":"tohenk@yahoo.com"},"license":"MIT","_id":"@ntlab/sfetch@1.1.0","maintainers":[{"name":"tohenk","email":"tohenk@yahoo.com"}],"homepage":"https://github.com/tohenk/node-sfetch#readme","bugs":{"url":"https://github.com/tohenk/node-sfetch/issues"},"dist":{"shasum":"ad77ca0312741e2de767311997aff3e18d78a06c","tarball":"https://registry.npmjs.org/@ntlab/sfetch/-/sfetch-1.1.0.tgz","fileCount":5,"integrity":"sha512-x9DQ+/Ez+m6g72d7rXhwScG4pdNTbDmeuakPGJtYVgNKUwzhvCtbDMYCF1ACSSJ4X9QWIbyX3EnT8ArlswYPGQ==","signatures":[{"sig":"MEYCIQDOHLel/t2+tDIZXYmsekjLo2jnbGaLKj5QImPYBj56RgIhAPlgeT4fOuJHry701nogEdUpnwNphKN1b3Y2+CUbDxJW","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":15409},"main":"index.js","gitHead":"04a82d394ed898a39de0cccf62dd0c00d2db7299","scripts":{"test":"node test.js"},"_npmUser":{"name":"tohenk","email":"tohenk@yahoo.com"},"repository":{"url":"git+https://github.com/tohenk/node-sfetch.git","type":"git"},"_npmVersion":"11.0.0","description":"Simultaneously fetch urls","directories":{},"_nodeVersion":"22.12.0","dependencies":{"axios":"^1.7.9"},"_hasShrinkwrap":false,"devDependencies":{"http-request-mock":"^2.0.2"},"_npmOperationalInternal":{"tmp":"tmp/sfetch_1.1.0_1735726659418_0.6760792192118275","host":"s3://npm-registry-packages-npm-production"}},"1.2.0":{"name":"@ntlab/sfetch","version":"1.2.0","keywords":["simultaneous","fetch"],"author":{"name":"Toha","email":"tohenk@yahoo.com"},"license":"MIT","_id":"@ntlab/sfetch@1.2.0","maintainers":[{"name":"tohenk","email":"tohenk@yahoo.com"}],"homepage":"https://github.com/tohenk/node-sfetch#readme","bugs":{"url":"https://github.com/tohenk/node-sfetch/issues"},"dist":{"shasum":"a0f5d55a0a214245c66bca779685eb5f11459ba9","tarball":"https://registry.npmjs.org/@ntlab/sfetch/-/sfetch-1.2.0.tgz","fileCount":5,"integrity":"sha512-9SE4NnqWo8l6mG0rnAkgng6ozSamIpF3EC+GOTQGGa6eAC0tNJvzrylMz6YRjjEGH6mOfn7ZBAuKj5WIZUul6A==","signatures":[{"sig":"MEYCIQDZuAx2e4cJqheg22boUXOexVTQ8PDAz2RhyxfkdFZB/QIhANua0iN1oj1FUaeiu9y5IKP+RI0HWWe7ubJ7LxLAVvcp","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":16425},"main":"index.js","gitHead":"c58fe6dae10605952cffd25d11d4e3741a169d98","scripts":{"test":"node test.js"},"_npmUser":{"name":"tohenk","email":"tohenk@yahoo.com"},"repository":{"url":"git+https://github.com/tohenk/node-sfetch.git","type":"git"},"_npmVersion":"11.0.0","description":"Simultaneously fetch urls","directories":{},"_nodeVersion":"22.12.0","dependencies":{"axios":"^1.7.9"},"_hasShrinkwrap":false,"devDependencies":{"http-request-mock":"^2.0.2"},"_npmOperationalInternal":{"tmp":"tmp/sfetch_1.2.0_1737716231786_0.5865275787760449","host":"s3://npm-registry-packages-npm-production"}},"1.3.0":{"name":"@ntlab/sfetch","version":"1.3.0","keywords":["simultaneous","fetch"],"author":{"name":"Toha","email":"tohenk@yahoo.com"},"license":"MIT","_id":"@ntlab/sfetch@1.3.0","maintainers":[{"name":"tohenk","email":"tohenk@yahoo.com"}],"homepage":"https://github.com/tohenk/node-sfetch#readme","bugs":{"url":"https://github.com/tohenk/node-sfetch/issues"},"dist":{"shasum":"cddbecfcfbd7df0d47c796e96aa44943fd92f148","tarball":"https://registry.npmjs.org/@ntlab/sfetch/-/sfetch-1.3.0.tgz","fileCount":6,"integrity":"sha512-DZ38zPrxSgLjN5j+gfCU7WHl2LuNGgz2ru7UnojiNd27GJlrwkO1sYLVdG3uGhZIooaGYmQ4SBiV4uKNrn3UBA==","signatures":[{"sig":"MEQCIHmE4rkDGVSKR8udyxSqE810vAjteowwtI5/dKTfhTBIAiBz6m5GypXQfkjCnAGolYY7x0Zt8wCxsYVl2nu/x3Tr+A==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":18379},"main":"index.js","types":"index.d.ts","gitHead":"8a13b8ee0d1372dfc5087715dd82eb2e3ff889e8","scripts":{"test":"node test.js"},"_npmUser":{"name":"tohenk","email":"tohenk@yahoo.com"},"repository":{"url":"git+https://github.com/tohenk/node-sfetch.git","type":"git"},"_npmVersion":"11.12.1","description":"Simultaneously fetch urls","directories":{},"_nodeVersion":"24.15.0","dependencies":{"axios":"^1.16.1"},"_hasShrinkwrap":false,"devDependencies":{"http-request-mock":"^2.0.2"},"_npmOperationalInternal":{"tmp":"tmp/sfetch_1.3.0_1778987463577_0.6402222363304202","host":"s3://npm-registry-packages-npm-production"}},"1.4.0":{"name":"@ntlab/sfetch","version":"1.4.0","keywords":["simultaneous","fetch"],"author":{"name":"Toha","email":"tohenk@yahoo.com"},"license":"MIT","_id":"@ntlab/sfetch@1.4.0","maintainers":[{"name":"tohenk","email":"tohenk@yahoo.com"}],"homepage":"https://github.com/tohenk/node-sfetch#readme","bugs":{"url":"https://github.com/tohenk/node-sfetch/issues"},"dist":{"shasum":"2f306f90b675c947a932106a7c95f6b9e256c35b","tarball":"https://registry.npmjs.org/@ntlab/sfetch/-/sfetch-1.4.0.tgz","fileCount":6,"integrity":"sha512-/UATwPHGYc8myEWzZG2fTSdCDqVN+/09k4H3EwlcI9QjhLOulot/grxS4o2eQ4lv60QMDZBoLvu6FFbRjxeFnA==","signatures":[{"sig":"MEUCIBttkEV1riNbrjsU/+2nhS0HXsjMhNp3lzFJrF6HPIywAiEAmWif+VVMSD9fRfxYK5F1oCTxWiBRj6i4pJynPWxw+Zk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":20802},"main":"index.js","types":"index.d.ts","gitHead":"48c2efbb23f66930c6f39fdb7a7947b091b458f2","scripts":{"test":"node test.js"},"_npmUser":{"name":"tohenk","email":"tohenk@yahoo.com"},"repository":{"url":"git+https://github.com/tohenk/node-sfetch.git","type":"git"},"_npmVersion":"11.16.0","description":"Simultaneously fetch urls","directories":{},"_nodeVersion":"24.16.0","dependencies":{"axios":"^1.16.1"},"_hasShrinkwrap":false,"devDependencies":{"http-request-mock":"^2.0.2"},"_npmOperationalInternal":{"tmp":"tmp/sfetch_1.4.0_1780383293238_0.5208055667852152","host":"s3://npm-registry-packages-npm-production"}},"1.5.0":{"name":"@ntlab/sfetch","version":"1.5.0","description":"Simultaneously fetch urls","main":"index.js","types":"index.d.ts","scripts":{"test":"node test.js"},"repository":{"type":"git","url":"git+https://github.com/tohenk/node-sfetch.git"},"keywords":["simultaneous","fetch"],"author":{"name":"Toha","email":"tohenk@yahoo.com"},"license":"MIT","bugs":{"url":"https://github.com/tohenk/node-sfetch/issues"},"homepage":"https://github.com/tohenk/node-sfetch#readme","dependencies":{"axios":"^1.18.1"},"devDependencies":{"http-request-mock":"^2.0.2"},"gitHead":"5d990a076081e4b5d5e362981250db55ce66c8c2","_id":"@ntlab/sfetch@1.5.0","_nodeVersion":"24.18.0","_npmVersion":"11.17.0","dist":{"integrity":"sha512-0iI8YMYJtZUDRHrUsbyJ80MjjWugkvbcIUJKTTZrEYy+a+wusSD9QNQ8z4stajQFzDBIvzogO+T0ztlt8Cs7cA==","shasum":"e366f78fdb96c399e3df9bdbd9686961b39b3e1a","tarball":"https://registry.npmjs.org/@ntlab/sfetch/-/sfetch-1.5.0.tgz","fileCount":6,"unpackedSize":21835,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIGPObRUWljFx8sNwMowFT6iZRy594vn4Huo4cSfb0q2aAiEA4IYMPopdYfsRrzOEN4BCj5qOWhaf7jC+Au0eGc1e/+k="}]},"_npmUser":{"name":"tohenk","email":"tohenk@yahoo.com"},"directories":{},"maintainers":[{"name":"tohenk","email":"tohenk@yahoo.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sfetch_1.5.0_1782546206392_0.7054467200337493"},"_hasShrinkwrap":false}},"time":{"created":"2024-12-18T09:56:09.453Z","modified":"2026-06-27T07:43:26.663Z","1.0.0":"2024-12-18T09:56:09.774Z","1.1.0":"2025-01-01T10:17:39.628Z","1.2.0":"2025-01-24T10:57:11.972Z","1.3.0":"2026-05-17T03:11:03.713Z","1.4.0":"2026-06-02T06:54:53.376Z","1.5.0":"2026-06-27T07:43:26.529Z"},"bugs":{"url":"https://github.com/tohenk/node-sfetch/issues"},"author":{"name":"Toha","email":"tohenk@yahoo.com"},"license":"MIT","homepage":"https://github.com/tohenk/node-sfetch#readme","keywords":["simultaneous","fetch"],"repository":{"type":"git","url":"git+https://github.com/tohenk/node-sfetch.git"},"description":"Simultaneously fetch urls","maintainers":[{"name":"tohenk","email":"tohenk@yahoo.com"}],"readme":"# Simultaneously Fetch URLs\r\n\r\nSimultaneously fetch urls using Axios.\r\n\r\n## Usage\r\n\r\nThis module export `doFetch` function with the following signatures:\r\n\r\n```js\r\n/**\r\n * @param {array<string|object>} queues The queues\r\n * @param {completeCallback} callback Queue completion callback\r\n */\r\nasync function doFetch(queues, callback) {\r\n}\r\n```\r\n\r\n```js\r\n/**\r\n * @param {array<string|object>} queues The queues\r\n * @param {object} options The options\r\n * @param {number} options.worker Maximum number of simultaneous workers\r\n * @param {boolean} options.checkResult Fire callback only when request is successful or not\r\n * @param {Function} options.debug Debugger function\r\n * @param {completeCallback} callback Queue completion callback\r\n */\r\nasync function doFetch(queues, options, callback) {\r\n}\r\n```\r\n\r\nThe `queues` parameter can be a simple string array as of `['url', 'url', ...]` or a complex object.\r\nFor complex objects, the following property is recognized:\r\n\r\n* `url`, the url to fetch.\r\n\r\n* `method`, the method to use, either `get` or `post` is supported. If none specified it will be assumed as `get`.\r\n\r\n* `params`, parameters which can includes request `headers`, URL parameters `params`, or anything else\r\n  of Axios [Request Config](https://axios-http.com/docs/req_config).\r\n\r\nThe `callback` will be called once each queue completed. The callback function signature is described as:\r\n\r\n```js\r\n/**\r\n * @param {string|object} queue Fetched queue which is complete\r\n * @param {string|object} res Response content returned by axios\r\n * @param {object} headers Response headers returned by axios\r\n */\r\nfunction callback(queue, res, headers) {\r\n}\r\n```\r\n\r\nAn additional configuration can be used to adjust `doFetch` behavior globally:\r\n\r\n* The number of simultaneous workers by default set to 25 workers. To change the number of workers,\r\n  call `doFetch.setMaxWoker()` with desired value, e.g. `doFetch.setMaxWoker(10)`.\r\n\r\n* The callback by default will not be fired if the response is empty. To force to always to fire\r\n  the callback regardless of the response, set with `doFetch.setCheckResult(false)`\r\n\r\n* To enable debugging, set the debugger function such as `console.log` using `doFetch.setDebugger(console.log)`.\r\n\r\n## Examples\r\n\r\n### Fetch some urls\r\n\r\n```js\r\nconst doFetch = require('@ntlab/sfetch');\r\n\r\n(async function run() {\r\n    await doFetch([\r\n        'https://example.com/foo',\r\n        'https://example.com/bar'\r\n    ], function(url, res, headers) {\r\n        if (res) {\r\n            // do something here\r\n        }\r\n    });\r\n})();\r\n```\r\n\r\n### Fetch some urls for further processing\r\n\r\n```js\r\nconst doFetch = require('@ntlab/sfetch');\r\n\r\n(async function run() {\r\n    const headers: {\r\n        'User-Agent': 'My-User-Agent/1.0'\r\n    }\r\n    await doFetch([\r\n        {\r\n            for: 'foo',\r\n            url: 'https://example.com/foo',\r\n            method: 'get',\r\n            params: {\r\n                headers,\r\n                params: { data: 'foo' }\r\n            }\r\n        },\r\n        {\r\n            for: 'bar',\r\n            url: 'https://example.com/bar',\r\n            method: 'post',\r\n            params: {\r\n                headers,\r\n                params: { data: 'bar' },\r\n                data: { bar: 'baz' }\r\n            }\r\n        }\r\n    ], function(queue, res, headers) {\r\n        if (queue.for === 'foo') {\r\n            // do something for foo\r\n        }\r\n        if (queue.for === 'bar') {\r\n            // do something for bar\r\n        }\r\n    });\r\n})();\r\n```\r\n\r\n### Queue more urls\r\n\r\n```js\r\nconst doFetch = require('@ntlab/sfetch');\r\n\r\n(async function run() {\r\n    const queues = ['https://example.com/foo']; \r\n    await doFetch(queues, function(url, res) {\r\n        // queue returned urls from JSON response\r\n        if (res && res.urls) {\r\n            queues.push(...res.urls);\r\n        }\r\n    });\r\n})();\r\n```\r\n","readmeFilename":"README.md"}