How to use the @cliqz/adblocker.FiltersEngine.parse function in @cliqz/adblocker

To help you get started, we’ve selected a few @cliqz/adblocker examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wexond / desktop / src / main / services / web-request.ts View on Github external
Axios.all(ops).then(res => {
      let data = '';

      for (const res1 of res) {
        data += res1.data;
      }

      engine = FiltersEngine.parse(data);

      writeFile(path, engine.serialize(), err => {
        if (err) return console.error(err);
      });
    });
  };
github cliqz-oss / adblocker / packages / adblocker-benchmarks / blockers / cliqz-base.js View on Github external
static parse(rawLists, enableCompression) {
    return new Cliqz(FiltersEngine.parse(rawLists, {
      enableCompression,
      integrityCheck: false,
      loadCosmeticFilters: false,
    }));
  }
github cliqz-oss / adblocker / bench / utils.ts View on Github external
export function createEngine(lists: string[], resources: string, options = {}, serialize = false) {
  const engine = FiltersEngine.parse(lists.join('\n'), options);

  engine.updateResources(resources, '');

  return {
    engine,
    serialized: serialize ? engine.serialize() : undefined,
  };
}