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 πŸ™

Β© 2026 – Pkg Stats / Ryan Hefner

grab-url

v1.0.20

Published

πŸ“₯ Generate Request to API from Browser

Downloads

688

Readme

npm i grab-url

GRAB: Generate Request to API from Browser

  1. GRAB is the FBEST Request Manager: Functionally Brilliant, Elegantly Simple Tool: One Function, no dependencies, minimalist syntax, more features than alternatives
  2. Auto-JSON Convert: Pass parameters and get response or error in JSON, handling other data types as is.
  3. isLoading Status: Sets .isLoading=true on the pre-initialized response object so you can show a "Loading..." in any framework
  4. Debug Logging: Adds global log() and prints colored JSON structure, response, timing for requests in test.
  5. Mock Server Support: Configure window.grab.mock for development and testing environments
  6. Cancel Duplicates: Prevent this request if one is ongoing to same path & params, or cancel the ongoing request.
  7. Timeout & Retry: Customizable request timeout, default 30s, and auto-retry on error
  8. DevTools: Ctrl+Alt+I overlays webpage with devtools showing all requests and responses, timing, and JSON structure.
  9. Request History: Stores all request and response data in global grab.log object
  10. Pagination Infinite Scroll: Built-in pagination for infinite scroll to auto-load and merge next result page, with scroll position recovery.
  11. Base URL Based on Environment: Configure grab.defaults.baseURL once at the top, overide with SERVER_API_URL in .env.
  12. Frontend Cache: Set cache headers and retrieve from frontend memory for repeat requests to static data.
  13. Regrab On Error: Regrab on timeout error, or on window refocus, or on network change, or on stale data.
  14. Framework Agnostic: Alternatives like TanStack work only in component initialization and depend on React & others.
  15. Globals: Adds to window in browser or global in Node.js so you only import once: grab(), log(), grab.log, grab.mock, grab.defaults
  16. TypeScript Tooltips: Developers can hover over option names and autocomplete TypeScript.
  17. Request Stategies: 🎯 Examples show common stategies like debounce, repeat, proxy, unit tests, interceptors, file upload, etc
  18. Rate Limiting: Built-in rate limiting to prevent multi-click cascading responses, require to wait seconds between requests.
  19. Repeat: Repeat request this many times, or repeat every X seconds to poll for updates.
  20. Loading Icons: Import from grab-url/icons to get enhanced animated loading icons.

Examples

import grab from 'grab-url';

let res = $state({}) as {
  results: Array<{title:string}>,
  isLoading: boolean,
  error: string,
};

await grab('search', {
  response: res,
  query: "search words",
  post: true
})
 
grab('user').then(log)

//in svelte component
{#if res.results}
    {res.results}
{:else if res.isLoading}
    ...
{:else if res.error}
    {res.error}
{/if}

 //Setup Mock testing server, response is object or function
 window.grab.mock["search"] = {
   response: (params) => {
     return { results: [{title:`Result about ${params.query}`}] };
   },
   method: "POST"
 };

 //set defaults for all requests
 grab("", { 
   setDefaults: true,
   baseURL: "http://localhost:8080",
   timeout: 30,
   debug: true,
   rateLimit: 1,
   cache: true,
   cancelOngoingIfNew: true,
 });

 grab.defaults.baseURL = "http://localhost:8080/api/";

Screenshots

Animated SVG Loading Icons with Customizable Colors

icons

Set Types for Tooltips on Request & Response

types

Debug Colorized log(JSON)

Debug log

Autocomplete option names

Autocomplete

Hover over options for info

Info Tooltip

Comparison of HTTP Request Libraries

| Feature | GRAB | Axios | TanStack Query | SWR | Alova | SuperAgent | Apisauce | Ky | | :-- | :-- | :-- | :-- | :-- | :-- | :-- | :-- | :-- | | Size | βœ… 4KB | ❌ 13KB | ❌ 39KB | βœ… 4.2KB | βœ… 4KB | ❌ 19KB | ❌ 15KB (with axios) | βœ… 4KB | | Zero Dependencies | βœ… Yes | ❌ No | ❌ No | ❌ No | βœ… Yes | ❌ No | ❌ Needs Axios | βœ… Yes | | isLoading State Handling | βœ… Auto-managed | ❌ Manual | βœ… Yes | βœ… Yes | βœ… Yes | ❌ Manual | ❌ Manual | ❌ Manual | | Auto JSON Handling | βœ… Automatic | βœ… Configurable | ❌ Manual | ❌ Manual | βœ… Automatic | βœ… Automatic | βœ… Automatic | βœ… Automatic | | Request Deduplication | βœ… Built-in | ❌ No | βœ… Yes | βœ… Yes | βœ… Yes | ❌ No | ❌ No | ❌ No | | Caching | βœ… Multi-level | ❌ No | βœ… Advanced | βœ… Advanced | βœ… Multi-level | ❌ No | ❌ No | ❌ No | | Mock Testing | βœ… Easy setup | ❌ Needs MSW/etc | ❌ Needs MSW/etc | ❌ Needs MSW/etc | ⚠️ Basic | ❌ Needs separate lib | ❌ Needs separate lib | ❌ Needs MSW/etc | | Rate Limiting | βœ… Built-in | ❌ Manual | ❌ Manual | ❌ Manual | ⚠️ Basic | ❌ Manual | ❌ Manual | ❌ Manual | | Automatic Retry | βœ… Configurable | ⚠️ Via interceptors | βœ… Built-in | βœ… Built-in | βœ… Built-in | βœ… Built-in | ❌ Manual | βœ… Built-in | | Request Cancellation | βœ… Auto + manual | βœ… Manual | βœ… Automatic | βœ… Automatic | βœ… Manual | βœ… Manual | βœ… Manual | βœ… Manual | | Pagination Support | βœ… Infinite scroll | ❌ Manual | βœ… Advanced | ⚠️ Basic | βœ… Built-in | ❌ Manual | ❌ Manual | ❌ Manual | | Interceptors | βœ… Advanced | βœ… Advanced | ⚠️ Limited | ⚠️ Limited | βœ… Advanced | βœ… Plugins | βœ… Transforms | βœ… Hooks system | | Debug Logging | βœ… Colored output | ⚠️ Basic | βœ… DevTools | βœ… DevTools | ⚠️ Basic | ⚠️ Basic | ⚠️ Basic | ⚠️ Basic | | Request History | βœ… Built-in | ❌ Manual | βœ… DevTools | βœ… DevTools | ❌ Manual | ❌ Manual | ❌ Manual | ❌ Manual | | Easy Syntax | βœ… Minimal | ⚠️ Medium | ❌ High | ❌ High | ⚠️ Medium | ⚠️ Medium | βœ… Low | βœ… Minimal |

Stop trying to make fetch happen! *

Why fetch things when you can just GRAB?

Debugging requests is a bitch. Make the switch!

🌟 Star this repo so it will grow and get updates!