Installations
npm install rpc-bluebird
Developer Guide
Typescript
Yes
Module System
ESM
Min. Node Version
>=16.15.0
Node Version
16.15.1
NPM Version
8.13.1
Score
67.2
Supply Chain
99.3
Quality
75.9
Maintenance
100
Vulnerability
100
License
Releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (98.78%)
Shell (1.22%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
Download Statistics
Total Downloads
6,481
Last Day
1
Last Week
8
Last Month
53
Last Year
343
GitHub Statistics
252 Commits
1 Forks
2 Watching
3 Branches
3 Contributors
Sponsor this package
Package Meta Information
Latest Version
5.0.1
Package Id
rpc-bluebird@5.0.1
Unpacked Size
17.38 kB
Size
5.58 kB
File Count
10
NPM Version
8.13.1
Node Version
16.15.1
Total Downloads
Cumulative downloads
Total Downloads
6,481
Last day
0%
1
Compared to previous day
Last week
-66.7%
8
Compared to previous week
Last month
71%
53
Compared to previous month
Last year
-14.7%
343
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
rpc-bluebird
![GitHub top language](https://img.shields.io/github/languages/top/vansergen/rpc-bluebird)
rpc-bluebird
is a simple wrapper of the node-fetch
library in a class. Note, that the Blubird
promise library is used instead of native promises.
Installation
1npm install rpc-bluebird
Usage
rpc-bluebird
accepts the following parameters
1const fetchClientOptions = { 2 baseUrl: "http://worldtimeapi.org/", // used to resolve the url - `new URL(path, baseUrl)` 3 rejectNotOk: false, // default - `true`, reject a promise on non 2xx responses 4 transform: "text", // default - `'raw'` 5};
as fetchClientOptions
. Please refer to the node-fetch
documentation for the full list of all supported options you can pass as fetchOptions
.
1import { FetchClient } from "rpc-bluebird"; 2const fetchOptions = { headers: { "User-Agent": "MyClass-User-Agent" } }; 3const fetchClientOptions = { baseUrl: "http://worldtimeapi.org/" }; 4const path = "/api/ip"; 5class MyClass extends FetchClient { 6 constructor() { 7 super(fetchOptions, fetchClientOptions); 8 } 9} 10const myClass = new MyClass(); 11const bluebirdPromise = myClass.fetch(path); 12bluebirdPromise 13 .then((response) => { 14 console.info(bluebirdPromise.isResolved()); 15 response.json().then(console.log).catch(console.error); 16 }) 17 .catch(console.error); 18console.info(bluebirdPromise.isPending());
fetch
1import FetchClient from "rpc-bluebird"; 2const client = new FetchClient<unknown>({}, { transform: "json" }); 3client 4 .fetch("http://worldtimeapi.org/api/ip") 5 .then(console.log) 6 .catch(console.error);
HTTP methods.
get
1const client = new FetchClient<Buffer>({}, { transform: "buffer" }); 2client 3 .get("http://worldtimeapi.org/api/ip") 4 .then((data) => { 5 console.log(data instanceof Buffer); 6 }) 7 .catch(console.error);
post
1const client = new FetchClient<Buffer>( 2 { body: JSON.stringify({ data: "Hello World!" }) }, 3 { transform: "buffer" } 4); 5client 6 .post("https://httpbin.org/anything") 7 .then((data) => { 8 console.log(data instanceof Buffer); 9 }) 10 .catch(console.error);
put
1const client = new FetchClient<ArrayBuffer>( 2 { body: JSON.stringify({ data: "Hello World!" }) }, 3 { transform: "arrayBuffer" } 4); 5client 6 .put("https://httpbin.org/anything") 7 .then((data) => { 8 console.log(data instanceof ArrayBuffer); 9 }) 10 .catch(console.error);
patch
1import Blob from "fetch-blob"; 2const client = new FetchClient<Blob>( 3 { body: JSON.stringify({ data: "Hello World!" }) }, 4 { transform: "blob", rejectNotOk: true } 5); 6client 7 .patch("https://httpbin.org/anything") 8 .then((data) => { 9 console.log(data instanceof Blob); 10 }) 11 .catch(console.error);
delete
1const baseUrl = "https://httpbin.org/"; 2const client = new FetchClient<string>({ transform: "text", baseUrl }); 3client 4 .delete("/anything") 5 .then((data) => { 6 console.log(typeof data === "string"); 7 }) 8 .catch(console.error);
head
1import { UnsuccessfulFetch, FetchClient } from "rpc-bluebird"; 2const baseUrl = "http://worldtimeapi.org/"; 3const client = new FetchClient<unknown>({}, { transform: "json", baseUrl }); 4client 5 .head("/badurl") 6 .then(console.log) 7 .catch((error) => { 8 if (error instanceof UnsuccessfulFetch) { 9 console.log(error.response.status); // 404 10 } else { 11 console.error(error); 12 } 13 });
options
1const baseUrl = "https://httpbin.org/"; 2const client = new FetchClient<unknown>({}, { transform: "json", baseUrl }); 3client.options("/anything").then(console.log).catch(console.error);
![Empty State](/_next/static/media/empty.e5fae2e5.png)
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
dependency not pinned by hash detected -- score normalized to 5
Details
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:67: update your workflow using https://app.stepsecurity.io/secureworkflow/vansergen/rpc-bluebird/ci.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:76: update your workflow using https://app.stepsecurity.io/secureworkflow/vansergen/rpc-bluebird/ci.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:78: update your workflow using https://app.stepsecurity.io/secureworkflow/vansergen/rpc-bluebird/ci.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:95: update your workflow using https://app.stepsecurity.io/secureworkflow/vansergen/rpc-bluebird/ci.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:99: update your workflow using https://app.stepsecurity.io/secureworkflow/vansergen/rpc-bluebird/ci.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/vansergen/rpc-bluebird/ci.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/vansergen/rpc-bluebird/ci.yml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:48: update your workflow using https://app.stepsecurity.io/secureworkflow/vansergen/rpc-bluebird/ci.yml/main?enable=pin
- Info: 0 out of 6 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 2 third-party GitHubAction dependencies pinned
- Info: 3 out of 3 npmCommand dependencies pinned
Reason
Found 0/6 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/ci.yml:1
- Info: no jobLevel write permissions found
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'main'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 27 are checked with a SAST tool
Reason
12 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j
- Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22
- Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55
- Warn: Project is vulnerable to: GHSA-vp56-6g26-6827
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
- Warn: Project is vulnerable to: GHSA-f9xv-q969-pqx4
Score
2.8
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More