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

@igor.dvlpr/adblock-header-extract

v1.0.0

Published

✂️ An npm module that provides ways to extract header and metadata from an Adblock filter file. 📃

Downloads

6

Readme

🕵🏼 Usage

Install it by executing:

npm i "@igor.dvlpr/adblock-header-extract"

🤹🏼 API

function extractHeaderString(
  filter: string,
  trimWhitespace: boolean = true
): string

Extracts the header and metadata from an Adblock filter text.

  • filter - the string that contains the Adblock filter,
  • trimWhitespace - should the whitespace be trimmed or not. Defaults to true.

Returns the extracted header.


function extractHeaderString(
  filter: string,
  trimWhitespace: boolean = true
): string

Extracts the header and metadata from an Adblock filter file. File is read with the UTF-8 encoding by default.

  • file - the path to the filter file,
  • trimWhitespace - should the whitespace be trimmed or not. Defaults to true.

[!CAUTION] Will throw an error if the file cannot be found or there is an error in reading it.

Returns the extracted header.


✨ Example

./example.ts

import { extractHeaderFromFile, extractHeaderString } from '@igor.dvlpr/adblock-header-extract'

console.log(extractHeaderFromFile('./filter.txt'))

// will print

/*
[Adblock Plus 2.0]
!
!     ___        __   _    __        _      __
!    /   |  ____/ /  | |  / /____   (_)____/ /
!   / /| | / __  /   | | / // __ \ / // __  /
!  / ___ |/ /_/ /    | |/ // /_/ // // /_/ /
! /_/  |_|\____/     |___/ \____//_/ \____/
!
!
! {@!}
! Title: AdVoid.Full
! Description: Blocks major ad-servers, trackers, malware, fake download links, cookie-consent banners, popups, modals, push notifications, survey, newsletter and subscribe popups, sharing, Google Chromecast, popup chats, post widgets, like widgets, comments, service workers, news widgets, JavaScript and CSS maps, PWA install banners, Webmanifests, SWF objects
! Version: 3.0.3340
! Last modified: 2024-07-15T02:07:07.895+02:00
! Expires: 24 hours (update frequency)
! Homepage: https://github.com/the-advoid/ad-void
! Entries: 6615
! Author: Igor Dimitrijević (@igorskyflyer)
! GitHub issues: https://github.com/the-advoid/ad-void/issues
! GitHub pull requests: https://github.com/the-advoid/ad-void/pulls
! License: https://github.com/the-advoid/ad-void/blob/main/LICENSE
! Maintained by: Aria, igorskyflyer and all of the contributors
! See the CONTRIBUTORS.md (https://github.com/the-advoid/ad-void/blob/main/CONTRIBUTORS.md) file for more information
! Source: World Wide Web
*/

./filter.txt

[Adblock Plus 2.0]
!
!     ___        __   _    __        _      __
!    /   |  ____/ /  | |  / /____   (_)____/ /
!   / /| | / __  /   | | / // __ \ / // __  /
!  / ___ |/ /_/ /    | |/ // /_/ // // /_/ /
! /_/  |_|\____/     |___/ \____//_/ \____/
!
!
! {@!}
! Title: AdVoid.Full
! Description: Blocks major ad-servers, trackers, malware, fake download links, cookie-consent banners, popups, modals, push notifications, survey, newsletter and subscribe popups, sharing, Google Chromecast, popup chats, post widgets, like widgets, comments, service workers, news widgets, JavaScript and CSS maps, PWA install banners, Webmanifests, SWF objects
! Version: 3.0.3340
! Last modified: 2024-07-15T02:07:07.895+02:00
! Expires: 24 hours (update frequency)
! Homepage: https://github.com/the-advoid/ad-void
! Entries: 6615
! Author: Igor Dimitrijević (@igorskyflyer)
! GitHub issues: https://github.com/the-advoid/ad-void/issues
! GitHub pull requests: https://github.com/the-advoid/ad-void/pulls
! License: https://github.com/the-advoid/ad-void/blob/main/LICENSE
! Maintained by: Aria, igorskyflyer and all of the contributors
! See the CONTRIBUTORS.md (https://github.com/the-advoid/ad-void/blob/main/CONTRIBUTORS.md) file for more information
! Source: World Wide Web

! {@0} Domains (global)
||02cscosgbuzl.top^
||05e11c9f6f.com^
||0af2a962b0102942d9a7df351b20be55.com^

📝 Changelog

✨ Changelog is available here: CHANGELOG.md.


🪪 License

Licensed under the MIT license which is available here, MIT license.


🧬 Related

@igor.dvlpr/aria

🧬 Meet Aria, an efficient Adblock filter list compiler, with many features that make your maintenance of Adblock filter lists a breeze! 🦖

@igor.dvlpr/strip-headings

⛸ Strips Markdown headings!🏹

@igor.dvlpr/adblock-filter-counter

🐲 A dead simple npm module that counts Adblock filter rules.🦘

@igor.dvlpr/jmap

🕶️ Reads a JSON file into a Map. 🌻

@igor.dvlpr/strip-html-headings

🍛 Strips HTML headings! 🍤


Provided by Igor Dimitrijević (@igorskyflyer).