{"_id":"@0xbeejs/fetch","_rev":"1-1eb455999a33948e7ba6214ea1827f9e","name":"@0xbeejs/fetch","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.1":{"name":"@0xbeejs/fetch","version":"0.0.1","keywords":["0xbeejs","fetch"],"license":"MIT","_id":"@0xbeejs/fetch@0.0.1","maintainers":[{"name":"189","email":"shangwenwang20@gmail.com"}],"dist":{"shasum":"acc603037b6615cdf4a77371fdbbc78640ae7e27","tarball":"https://registry.npmjs.org/@0xbeejs/fetch/-/fetch-0.0.1.tgz","fileCount":5,"integrity":"sha512-VUAm5tQ4Ciwo2JKh0oEMMSk++eAAOpziq8fZwJB3D+alJUNLvAROcBgwGqtdyLb+X9LWU5eb9Ad2AjaKWzW9iw==","signatures":[{"sig":"MEUCIQC/Zny2m8FxmoqwwKManOroypnqRc8Y0Hb6LVH9UbnZCQIgGU/ttQzLtsqyXy73uKhmLdryo7w78+xbZIxV0+CKoWk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":8199},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","gitHead":"2c88f85861231306ddbdf91cdbbfd56df9432077","scripts":{"dev":"tsup --watch","lint":"eslint \"src/**/*.ts*\"","test":"jest","build":"tsup","clean":"rm -rf .turbo && rm -rf node_modules && rm -rf dist","test:watch":"jest --watch"},"_npmUser":{"name":"189","email":"shangwenwang20@gmail.com"},"_npmVersion":"10.8.2","description":"Provides an interface for fetching resources, base on [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API).","directories":{},"sideEffects":false,"_nodeVersion":"20.18.1","dependencies":{"cross-fetch":"^3.1.6","https-proxy-agent":"^7.0.4"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","tsup":"^5.10.1","eslint":"^8.15.0","ts-jest":"^29.2.5","ts-node":"^10.9.2","supertest":"^6.3.3","ts-loader":"^9.4.3","typescript":"^4.5.3","@types/jest":"^29.5.14","@types/node":"^17.0.45","@jest/globals":"^29.7.0","@types/supertest":"^6.0.0","@0xbeejs/tsconfig":"*","source-map-support":"^0.5.21","@0xbeejs/jest-config":"*","@0xbeejs/eslint-config":"*"},"_npmOperationalInternal":{"tmp":"tmp/fetch_0.0.1_1735021624365_0.7146094543721437","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"@0xbeejs/fetch","version":"0.0.2","main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","sideEffects":false,"license":"MIT","scripts":{"build":"tsup","dev":"tsup --watch","lint":"eslint \"src/**/*.ts*\"","test":"jest","test:watch":"jest --watch","clean":"rm -rf .turbo && rm -rf node_modules && rm -rf dist"},"devDependencies":{"@0xbeejs/eslint-config":"*","@0xbeejs/tsconfig":"*","@0xbeejs/jest-config":"*","@types/node":"^17.0.45","@jest/globals":"^29.7.0","@types/jest":"^29.5.14","@types/supertest":"^6.0.0","eslint":"^8.15.0","jest":"^29.7.0","source-map-support":"^0.5.21","supertest":"^6.3.3","ts-jest":"^29.2.5","ts-loader":"^9.4.3","ts-node":"^10.9.2","tsup":"^5.10.1","typescript":"^4.5.3"},"publishConfig":{"access":"public"},"dependencies":{"https-proxy-agent":"^7.0.4","cross-fetch":"^3.1.6"},"keywords":["0xbeejs","fetch"],"_id":"@0xbeejs/fetch@0.0.2","gitHead":"fed95505c9f198ff205c834ba01e3f05600d5655","description":"Provides an interface for fetching resources, base on [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API).","_nodeVersion":"20.18.1","_npmVersion":"10.8.2","dist":{"integrity":"sha512-xVZANVjIpd0pOoNynDUUZeKPPdxpKtZ08vcxhIZ4cdxq67azhelLOGYsyNrK7AYPka6b2PfFWGIl8o3ng6YW0A==","shasum":"ee620e796d434871da1a78999c2c800f1d4c1abb","tarball":"https://registry.npmjs.org/@0xbeejs/fetch/-/fetch-0.0.2.tgz","fileCount":5,"unpackedSize":8234,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDmwnzAt22/cp64sbbh6LKeDX3IzrWuPH0Y5Gt1HI3gLAIgeWzV/e82A0EBRzcEAtXukS99IH5k25ygE+yqKtg+MbU="}]},"_npmUser":{"name":"189","email":"shangwenwang20@gmail.com"},"directories":{},"maintainers":[{"name":"189","email":"shangwenwang20@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/fetch_0.0.2_1735110674467_0.2615451075812387"},"_hasShrinkwrap":false}},"time":{"created":"2024-12-24T06:27:04.256Z","modified":"2024-12-25T07:11:14.840Z","0.0.1":"2024-12-24T06:27:04.545Z","0.0.2":"2024-12-25T07:11:14.623Z"},"license":"MIT","keywords":["0xbeejs","fetch"],"description":"Provides an interface for fetching resources, base on [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API).","maintainers":[{"name":"189","email":"shangwenwang20@gmail.com"}],"readme":"# @0xbeejs/fetch\n\nProvides an interface for fetching resources, base on [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API).\n\n# Fetures\n\n- Supports Node.js and browsers\n- Supports specifying a timeout.\n- Supports specifying a proxy.\n\n## Installation\n\n```\n$ yarn add @0xbeejs/fetch\n```\n\n## Usage\n\n#### fetch\n\n```nodejs\nimport fetch from \"@0xbeejs/fetch\";\n\n\nfunction fetchWithTimeout() {\n    const timeout = 15000; // 15s\n    return fetch(\"http://www.google.com\", {\n        // optional\n        proxyUrl: \"http://127.0.0.1:7890\",\n    }, timeout)\n}\n\n\nconst rsp = await fetchWithTimeout()\n\nconsole.log(await rsp.text())\n\n```\n\n#### faithfulRequest\n\nExecute a specific asynchronous action until timeout, supporting automatic retries, specifying the number of retries, and retry conditions.\n\n```\nimport fetch from \"@0xbeejs/fetch\";\n\n\nfunction fetchWithTimeout() {\n    const timeout = 15000; // 15s\n    return fetch(\"http://www.google.com\", {\n        // optional\n        proxyUrl: \"http://127.0.0.1:7890\",\n    }, timeout)\n}\n\nconst resp = await faithfulRequest({\n    req: () => fetchWithTimeout(),\n    id: \"get_google_homepage\",\n    // Optional. The assertion is true, and it will continue retrying until the maximum number of attempts is reached.\n    maxRetries: -1, // -1: no limit,\n    // Optional\n    assert: (ex) => ex.name === \"timeout\" // 'true' will retry util reach the 'maxRetries'\n    // Optional, how long to wait before starting the next request\n})\n```\n","readmeFilename":"README.md"}