JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2719
  • Score
    100M100P100Q122175F
  • License MIT

TypeScript definitions for from2

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@types/from2) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    Installation

    npm install --save @types/from2

    Summary

    This package contains type definitions for from2 (https://github.com/hughsk/from2).

    Details

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

    index.d.ts

    /// <reference types="node" />
    import stream = require("stream");
    
    export = from2;
    
    declare function from2(read: from2.ReadInput): from2.Stream;
    declare function from2(opts: from2.ObjectModeOptions, read: from2.ReadObjectInput): from2.Stream;
    declare function from2(opts: from2.Options, read: from2.ReadInput): from2.Stream;
    
    declare namespace from2 {
        interface Stream extends NodeJS.ReadableStream {
            readonly destroyed: boolean;
            destroy: (err?: Error) => void;
        }
        function obj(read: ReadObjectInput): Stream;
        function obj(opts: { objectMode?: true | undefined } & stream.ReadableOptions, read: ReadObjectInput): Stream;
    
        function ctor(opts?: Options): From2Ctor<ReadInput>;
        function ctor(opts: ObjectModeOptions): From2Ctor<ReadObjectInput>;
    
        type ObjectModeOptions = { objectMode: true } & stream.ReadableOptions;
        type Options = { objectMode?: false | undefined } & stream.ReadableOptions;
    
        type From2Ctor<R extends ReadInput | ReadObjectInput> = new(read: R) => Stream;
    
        type ReadObjectInput = ReadCallback<NextObjectCallback> | any[];
        type ReadInput = ReadCallback<NextCallback> | Chunk[];
        type ReadCallback<N extends NextCallback | NextObjectCallback> = (size: number, next: N) => void;
        type NextCallback = (err: any | undefined, chunk: Chunk) => void;
        type NextObjectCallback = (err: any | undefined, chunk: any) => void;
        type Chunk = string | Buffer | Uint8Array | null;
    }
    

    Additional Details

    • Last updated: Fri, 24 Oct 2025 04:02:41 GMT
    • Dependencies: @types/node

    Credits

    These definitions were written by BendingBender.