Socket
Socket
Sign inDemoInstall

nativeextractor.js

Package Overview
Dependencies
2
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    nativeextractor.js

NativeExtractor bindings for Node.js


Version published
Weekly downloads
6
increased by500%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

nativeextractor.js

This is official (NativeExtractor)[https://github.com/SpongeData-cz/nativeextractor] binding for Node.js

Python Logo

Installation

Requirements

  • Node.JS >=10
  • npm
  • build-essential (gcc, make)
  • libglib2.0, libglib2.0-dev

We recommend to use virtual environments.

sudo pip install nodeenv
nodeenv myproject
source myproject/bin/activate

Instant npm solution

TODO: npm install nativeextractor.js

Manual

  • Clone the repo git clone --recurse-submodules https://github.com/SpongeData-cz/nativeextractor-js.git

  • Install via npm

    npm install ./nativeextractor.js/
    

Typical usage

const ne = require('nativeextractor.js');
const path = require('path');

// Accumulated results
let results = [];

function test() {
    // Instantiate Extractor
    const ex = new ne.Extractor();
    // Add naive email miner - see src/example/naive_email_miner.c for details
    if (!ex.addMiner(path.join(ne.defaultMinersPath, "naive_email_miner.so"), "match_email_naive")) {
        console.log(ex.getLastError());
        return;
    }
    // String to extract on
    const buffer = "some@email.org dead beaf";

    // Create buffer stream (from memory)
    const stream = new ne.BufferStream(buffer);

    // Set the stream to the extractor
    ex.setStream(stream);

    // Check if stream is already on its end
    if (ex.eof()) {
        return;
    }

    // Pick next batch of result
    ex.next(function (err, res) {
        // Print found results
        console.log(res);
        results = [...results, ...res];
        if (ex.eof()) {
            // Unset stream for sure
            ex.unsetStream();
            return;
        }
        // Asynchronous recursion
        ex.next(arguments.callee);
    });
}

test();

Keywords

FAQs

Last updated on 16 Nov 2022

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