
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
infer-owner
Advanced tools
Infer the owner of a path based on the owner of its nearest existing parent
Infer the owner of a path based on the owner of its nearest existing parent
const inferOwner = require('infer-owner')
inferOwner('/some/cache/folder/file').then(owner => {
// owner is {uid, gid} that should be attached to
// the /some/cache/folder/file, based on ownership
// of /some/cache/folder, /some/cache, /some, or /,
// whichever is the first to exist
})
// same, but not async
const owner = inferOwner.sync('/some/cache/folder/file')
// results are cached! to reset the cache (eg, to change
// permissions for whatever reason), do this:
inferOwner.clearCache()
This module endeavors to be as performant as possible. Parallel requests for ownership of the same path will only stat the directories one time.
inferOwner(path) -> Promise<{ uid, gid }>
If the path exists, return its uid and gid. If it does not, look to its parent, then its grandparent, and so on.
inferOwner(path) -> { uid, gid }
Sync form of inferOwner(path).
inferOwner.clearCache()
Delete all cached ownership information and in-flight tracking.
Similar to infer-owner, chownr is designed to recursively change the ownership of a directory (and its contents) to the specified user and group. While infer-owner infers the ownership from existing parent directories, chownr requires the user to explicitly specify the desired ownership.
fs-extra extends the built-in Node.js fs module with additional functionality, including methods for changing file ownership. Although fs-extra does not specifically focus on inferring ownership like infer-owner, it provides a broader set of file system operations, including changing ownership.
FAQs
Infer the owner of a path based on the owner of its nearest existing parent
The npm package infer-owner receives a total of 7,656,963 weekly downloads. As such, infer-owner popularity was classified as popular.
We found that infer-owner demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

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.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.