Skip to content

Node.js 24: DeprecationWarning: fs.F_OK is deprecated, use fs.constants.F_OK instead #3324

@silverwind

Description

@silverwind

newman run on node 24 or higher produces this runtime deprecation warning:

(node:26419) [DEP0176] DeprecationWarning: fs.F_OK is deprecated, use fs.constants.F_OK instead
    at newman/lib/run/secure-fs.js:146:92
    at Array.map (<anonymous>)
    at Object.<anonymous> (newman/lib/run/secure-fs.js:144:32)

This is because the code (uselessly?) iterates over all enumerable properties of the fs module which triggers node's deprecation getters:

newman/lib/run/secure-fs.js

Lines 143 to 151 in 74a4554

// Attach all functions in fs to postman-fs
Object.getOwnPropertyNames(fs).map((prop) => {
// Bail-out early to prevent fs module from logging warning for deprecated and experimental methods
if (prop === DEPRECATED_SYNC_WRITE_STREAM || prop === EXPERIMENTAL_PROMISE || typeof fs[prop] !== FUNCTION) {
return;
}
SecureFS.prototype[prop] = fs[prop];
});

A quick workaround would be to add a exclusion for accessing F_OK.

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