1.0.4 • Published 6 years ago

infer-owner v1.0.4

Weekly downloads
10,543,477
License
ISC
Repository
github
Last release
6 years ago

infer-owner

Infer the owner of a path based on the owner of its nearest existing parent

USAGE

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.

API

  • 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.

vuedragdropuploadimagespopsmart-common-authkilli8n-react-native-fast-imagebb-chat@frxf/frxf@texttree/demo-bsa-reference-rcl@fundefund/funde_ckgql_din_mod@l1nyanm1ng/react-picture-viewer@saeon/ol-react@saeon/quick-formcogoportutilsjs4cytoscape@mink-opn/build-tokens@infinitebrahmanuniverse/nolb-infe@saaspe/componentsexpand-react-bridgenode-gio@everything-registry/sub-chunk-1912test-carosello-campustest-iki-mini-appwinx-form-winxweb-elements-iconsvue-button-test1wow.js-juziwuchuansupercluster-googlemaps-adapter-clonestestapatestujsk_custom_ckeditor5svelte-component-libtextfield-sample@drblmthw/testujsk_custom_ckeditor5@ct-note/image@ct-note/list@ct-note/paragraph@ct-note/checklist@ct-note/code@ct-note/embed@ct-note/header@cube-design/react@cybermega/flutter-resource-manager-rs@blkmarketco/components-library@beldore/react-otp-input@percent/percent-api-hooks@positionex/position-sdk@rbc-public/react-selectable-fastjeuxuijesusdemojamuskalimjameslinenode.js1@simstudio/htmldiffdfeuk-frontenddfeuk-frontend-manualsushi-sdk-ftm@castrum-nubis/bulmazzzxxxyyy321123styletoolsstnenopmoc-iustock-ticker-react-widgetud7-act2tingzi-vuepresstinymce-plugin-toyu-librarytldrawlignin@asiz33/smartblok-vendure-plugin@arielapaula/components@arielapaula/test@alta-ng-timeago/hiamtanh-alta@beisen/npm@buganto/client@carhoo/widget-dealers@cdk8s-extensions/argo-rollout@cleveradssolutions/cas.cordova.ironsource@cleveradssolutions/cas.cordova.kidoz@cleveradssolutions/cas.cordova.mintegral@cleveradssolutions/cas.cordova.mytarget@cleveradssolutions/cas.cordova.optimal@cleveradssolutions/cas.cordova.pangle@cleveradssolutions/cas.cordova.superawesome@cleveradssolutions/cas.cordova.tapjoy@cleveradssolutions/cas.cordova.unity@cleveradssolutions/cas.cordova.vungle@cleveradssolutions/cas.cordova.yandex@cleveradssolutions/cas.cordova.adcolony@cleveradssolutions/cas.cordova.admob@cleveradssolutions/cas.cordova.applovin@cleveradssolutions/cas.cordova.facebook@cleveradssolutions/cas.cordova.families@cleveradssolutions/cas.cordova.fyber@cleveradssolutions/cas.cordova.inmobivue-v3-yandex-metrikavinpmverify-img-codevformlmqzerionprokovanmail@parallelnft/web3modal@farvater/open-pedigree@harsha-jalan/ckeditor5-custom-build@hproinformatica/functions@hoaitt/ckeditor5-build-classic-mention
1.0.4

6 years ago

1.0.3

6 years ago