Skip to content

os.networkInterfaces().family is no longer a string #42953

Closed
@deftomat

Description

@deftomat

Version

v18.0.0

Platform

Darwin 21.4.0 Darwin Kernel Version 21.4.0: Fri Mar 18 00:46:32 PDT 2022; root:xnu-8020.101.4~15/RELEASE_ARM64_T6000 arm64

Subsystem

os

What steps will reproduce the bug?

The following code will throw an error as family is either a number 4 or 6.
Previously, it was a string as described in documentation https://nodejs.org/api/os.html#osnetworkinterfaces

import { networkInterfaces } from 'os';

Object.values(networkInterfaces()).flat()[0].family.toLowerCase();

How often does it reproduce? Is there a required condition?

Always

What is the expected behavior?

family should be either IPv4 or IPv6

What do you see instead?

Numbers 4 or 6

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions