TypeScript icon, indicating that this package has built-in type declarations

2.0.5 • Public • Published


npm install --save @types/netmask


This package contains type definitions for netmask (https://github.com/rs/node-netmask).


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


 * converts long to an ip address
export function long2ip(long: number): string;
 * converts ip address to long
export function ip2long(ip: string): number;

export class Netmask {
     * The base address of the network block as a string (eg: Base does not give an indication of the size of the network block.
    base: string;
     * The netmask as a string (eg:
    mask: string;
     * The netmask as a number of bits in the network portion of the address for this block (eg: 24).
    bitmask: number;
     * The host mask which is the opposite of the netmask (eg:
    hostmask: string;
     * The blocks broadcast address (eg: =>
    broadcast: string;
     * The number of IP addresses in a block (eg: 256).
    size: number;
     * First useable address
    first: string;
     * Last useable address
    last: string;

    maskLong: number;
    netLong: number;

     * Returns a true if the IP number ip is part of the network. That is, a true value is returned if ip is between base and broadcast.
     * If a Netmask object or a block is given, it returns true only of the given block fits inside the network.
    contains(address: string | Netmask | number): boolean;
     * Similar to the Array prototype method. It loops through all the useable addresses, ie between first and last.
    forEach(cb: (ip: string, long: number, index: number) => void): void;
     * Without a count, return the next block of the same size after the current one. With a count, return the Nth block after the current one.
     * A count of -1 returns the previous block. Undef will be returned if out of legal address space.
    next(count?: number): Netmask;
     * The netmask in base/bitmask format (e.g., '')
    toString(): string;

     * @param net A network - e.g
     * @param mask - optional netmask if not provided in `net`
    constructor(net: string, mask?: string | number);

Additional Details

  • Last updated: Tue, 07 Nov 2023 09:09:39 GMT
  • Dependencies: none


These definitions were written by Matt Frantz, JanST123, and Junxiao Shi.




Package Sidebar


npm i @types/netmask

Weekly Downloads






Unpacked Size

7.32 kB

Total Files


Last publish


  • types