npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@nicat.dcw/bralve

v2.0.1

Published

Simple HTTP/HTTPS Request Package for NodeJS.

Downloads

3

Readme

Bralve HTTP Request Module

The Bralve HTTP Request Module is a lightweight module for making HTTP and HTTPS requests in Node.js using the XMLHttpRequest API. It provides a simple and intuitive interface for making GET, POST, PATCH, PUT, and DELETE requests.

Updates (06/11/2023)

  • Added Types Support
  • Added CommonJS Support
  • Added Event Support
  • Some Performance Updates

Installation

Install the module using npm & yarn & pnpm:

npm install @nicat.dcw/bralve 
yarn add @nicat.dcw/bralve 
npm i pnpm && pnpm i @nicat.dcw/bralve/

Runtimes

also you can use bralve with typescript and commonjs.

Usage

import Bralve from '@nicat.dcw/bralve';

// Create an instance of the Request class
const request = new Bralve();

request.on("request", (res) => {
 console.log(res)
/* => 
{ type:"succeedRequest", requestresponse }
*/
})

// Make an HTTP GET request
request.get('http://jsonplaceholder.typicode.com/posts/1')
  .then(response => {
    console.log('Bralve Response:', response);
  })
  .catch(error => {
    console.error('Bralve Error:', error);
  });

// Make an HTTPS POST request
const postData = JSON.stringify({ title: 'foo', body: 'bar', userId: 1 });
request.post('https://jsonplaceholder.typicode.com/posts', postData, { headers: { 'Content-Type': 'application/json' } })
  .then(response => {
    console.log('Bralve POST Response:', response);
  })
  .catch(error => {
    console.error('Bralve POST Error:', error);
  });

API

Bralve

The Bralve class represents the HTTP request constructor.

get(url, config?)

Sends an HTTP GET request to the specified URL.

  • url (string): The URL to send the request to.
  • config (optional, object): Additional configuration options for the request.

post(url, data, config?)

Sends an HTTP POST request to the specified URL.

  • url (string): The URL to send the request to.
  • data (string): The request payload data.
  • config (optional, object): Additional configuration options for the request.

patch(url, data, config?)

Sends an HTTP PATCH request to the specified URL.

  • url (string): The URL to send the request to.
  • data (string): The request payload data.
  • config (optional, object): Additional configuration options for the request.

put(url, data, config?)

Sends an HTTP PUT request to the specified URL.

  • url (string): The URL to send the request to.
  • data (string): The request payload data.
  • config (optional, object): Additional configuration options for the request.

delete(url, config?)

Sends an HTTP DELETE request to the specified URL.

  • url (string): The URL to send the request to.
  • config (optional, object): Additional configuration options for the request.

head(url, config?)

Sends an HTTP HEAD request to the specified URL.

  • url (string): The URL to send the request to.
  • config (optional, object): Additional configuration options for the request.

on(event, fallback)

Shows emitted events data

  • event (string): The name of event. [request,error]
  • fallback (fallback, object): returns of result

License

This module is licensed under the MIT License.

Feel free to further customize the styling and content of the README.md file to suit your preferences and specific module details.

Let me know if there's anything else I can help you with!