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@cybermega/flutter-resource-manager-rs@blkmarketco/components-library@beldore/react-otp-inputjeuxuijesusdemojamuskalimjameslinenode.js1hubot-budahot-zone-vuegrid-component-react-ex-1guruwayguruway.jslitepie-datepicker-gabeluojia-cli-devmanan-react-native-expo-authorize-netm2m-chartjs-plugin-crosshairlabtesttwol2forlernakrown_login_librarymd-vditor@tillschweneker/ckeditor5-build-strapi-wysiwyg-markdown@udooku/react-image-comparison-slider@tonysusi/vapid@thedoctor0/vuex-shared-mutations@vitali_shcherbina/styled-lib@zalastax/nolb-infe@zh0st/evm-chains@zebracompany/f_editorained-ckeditor5b2x-utilsastra-ufo-sdkarifbudixzap-vue-captchaappcharge-checkoutappcd@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.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.inmobi@cleveradssolutions/cas.cordova.ironsource@cleveradssolutions/cas.cordova.kidoz@cleveradssolutions/cas.cordova.mintegral@cleveradssolutions/cas.cordova.mytarget@harsha-jalan/ckeditor5-custom-build@alta-ng-timeago/hiamtanh-alta@simstudio/htmldiffdfeuk-frontenddfeuk-frontend-manualsushi-sdk-ftm@castrum-nubis/bulmazzzxxxyyy321123styletoolsstnenopmoc-iustock-ticker-react-widgetud7-act2tingzi-vuepresstinymce-plugin-toyu-librarytldrawlignin
1.0.4

6 years ago

1.0.3

6 years ago