Socket
Socket
Sign inDemoInstall

walkers

Package Overview
Dependencies
57
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    walkers

Recursive DOM traversal using htmlparser2.


Version published
Weekly downloads
5
Maintainers
1
Install size
4.09 MB
Created
Weekly downloads
 

Readme

Source

Recursive DOM traversal using htmlparser2.

Getting Started

Install the module with: npm install walkers

var walkers = require('../lib/walkers.js');
var request = require('request');
var htmlparser = require("htmlparser2");

request('http://example.com', function (error, response, body) {
  if (!error && response.statusCode == 200) {
    var handler = new htmlparser.DomHandler(function (error, dom) {
      if (error) console.log(err)
      else {

        walkers.walk(dom, true, function(node){
          //Do something with leaf node
        }, function(){
          //Do something when finished walking
        })

      }
    });
    var parser = new htmlparser.Parser(handler);
    parser.write(body);
    parser.done();
  }
})

License

Copyright (c) 2015 Sterling Jordan Calder
Licensed under the MIT license.

Keywords

FAQs

Last updated on 27 Apr 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc