Generate an object for testing if a request is sent, request is Mikeal's request.
Switch branches/tags
Nothing to show
Clone or download
Latest commit fe1255d Aug 9, 2018
Failed to load latest commit information.
lib v2.0.0 Aug 9, 2018
test v2.0.0 Aug 9, 2018
.eslintrc.js refactor testing Jul 27, 2018
.gitignore remove tmp file May 13, 2015
.travis.yml update node engine version in travis Aug 9, 2018
LICENSE Initial commit May 10, 2015 update node engine version in travis Aug 9, 2018 update README and UPGRADE Oct 25, 2017
index.js v2.0.0 Aug 9, 2018
normalizer.js style fix Aug 2, 2018
package.json v2.0.0 Aug 9, 2018
repo.js v2.0.0 Aug 9, 2018


build status Dependency Status NPM download NPM quality


A library to test if a url/request is crawled, usually used in a web crawler. Compatible with request and node-crawler. The 1.x or newer version has quite different APIs and is not compatible with 0.x versions. Please read the upgrade guide document.

Table of Contents

Quick Start


$ npm install seenreq --save

Basic Usage

const seenreq = require('seenreq')
, seen = new seenreq();

//url to be normalized
let url = "";
console.log(seen.normalize(url));//{ sign: "GET\r\n", options: {} }

//request options to be normalized
let option = {
    uri: '',
    rupdate: false

console.log(seen.normalize(option));//{sign: "GET\r\n", options:{rupdate: false} }

    return seen.exists(url);
}).then( (rst) => {
    console.log(rst[0]);//false if ask for a `request` never see
    return seen.exists(opt);
}).then( (rst) => {
    console.log(rst[0]);//true if got same `request`

When you call exists, the module will do normalization itself first and then check if exists.

Use Redis

seenreq stores keys in memory by default, memory usage will soar as number of keys increases. Redis will solve this problem. Because seenreq uses ioredis as redis client, all ioredis' options are recived and supported. You should first install:

npm install seenreq-repo-redis --save

and then set repo to redis:

const seenreq = require('seenreq')
let seen = new seenreq({
    repo:'redis',// use redis instead of memory
    clearOnQuit:false // clear redis cache or don't when calling dispose(), default true.

    //do stuff...

Use mongodb

It is similar with redis above:

npm install seenreq-repo-mongo --save
const seenreq = require('seenreq')
let seen = new seenreq({
    collection: 'foor'


Instance of seenreq


Initialize the repo, returns a promise.


Returns normalized Object: {sign,options}.


Returns a promise with an Boolean array, e.g. [true, false, true, false, false].


Dispose resources of repo. If you are using repo other than memory, like Redis you should call dispose to release connection. Returns a promise.


  • removeKeys: Array, Ignore specified keys when doing normalization. For instance, there is a ts property in the url like which is timestamp and it should be same whenever you visit.
  • stripFragment: Boolean, Remove the fragment at the end of the URL (Default true).
  • rupdate: Boolean, it is short for repo update. Store in repo so that seenreq can hit the same req next time (Default true).


  • add mysql repo to persist keys to disk.
  • add keys life time management.