New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@types/streamsearch

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/streamsearch

TypeScript definitions for streamsearch

1.1.2
ts4.5
ts4.6
ts4.7
ts4.8
ts4.9
ts5.0
ts5.1
ts5.2
ts5.3
ts5.4
ts5.5
ts5.6
ts5.7
ts5.8
ts5.9
latest
Source
npm
Version published
Weekly downloads
11K
38.66%
Maintainers
1
Weekly downloads
 
Created
Source

Installation

npm install --save @types/streamsearch

Summary

This package contains type definitions for streamsearch (https://github.com/mscdex/streamsearch#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/streamsearch.

index.d.ts

/// <reference types="node" />

/**
 * callback is called any time there is non-matching data and/or there is a needle match.
 * @param isMatch Indicates whether a match has been found
 * @param data If set, this contains data that did not match the needle.
 * @param start he index in data where the non-matching data begins (inclusive).
 * @param end The index in data where the non-matching data ends (exclusive).
 * @param isSafeData Indicates if it is safe to store a reference to data (e.g. as-is or via data.slice()) or not, as in some cases data may point to a Buffer whose contents change over time.
 */
type MatchCallback = (
    isMatch: boolean,
    data: Buffer | undefined,
    start: number,
    end: number,
    isSafeData?: boolean,
) => void;

declare class SBMH {
    /**
     * The maximum number of matches.
     * @default Infinity
     */
    maxMatches: number;

    /**
     * The current match count.
     * @default 0
     */
    matches: number;

    /**
     * Creates and returns a new instance for searching for a Buffer or string needle. callback is called any time there is non-matching data and/or there is a needle match.
     * @param needle
     * @param cb
     */
    constructor(needle: Buffer | string, cb: MatchCallback);

    /**
     * Resets internal state. Useful for when you wish to start searching a new/different stream for example.
     */
    reset(): void;

    /**
     * Processes chunk, searching for a match.
     * @param chunk
     * @param pos
     * @returns The value is the last processed index in chunk + 1.
     */

    push(chunk: Buffer | string, pos?: number): number;
    /**
     * Emits any last remaining unmatched data that may still be buffered and then resets internal state.
     */
    destroy(): void;
}

export = SBMH;

Additional Details

  • Last updated: Tue, 07 Nov 2023 15:11:36 GMT
  • Dependencies: @types/node

Credits

These definitions were written by Abdelhadi Sabani.

FAQs

Package last updated on 07 Nov 2023

Did you know?

Socket

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