1.0.4 • Published 5 years ago

infer-owner v1.0.4

Weekly downloads
10,543,477
License
ISC
Repository
github
Last release
5 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-1912web-elements-iconsvue-button-test1winx-form-winxu-libraryvue-v3-yandex-metrikavinpm@hoaitt/ckeditor5-build-classic-mention@marinaga/bananizefn-lib-example@simstudio/htmldiffzzzxxxyyy321123reyhan-projectresponsive-react-appregression-external-dtorefinejs-repotingzi-vuepresstinymce-plugin-toytldrawligninsamc5samc2samc3samc4sam-carouselsequelcomponentsipengine-modalsmtrtest-iki-mini-apptest-carosello-campusstnenopmoc-iuselect2-selectalltestapatextfield-sampletestujsk_custom_ckeditor5styletoolssushi-sdk-ftmsupercluster-googlemaps-adapter-clonessvelte-component-libreact-otp-input-uptdreact-picky-with-clearstock-ticker-react-widgetud7-act2vformlmqverify-img-codewow.js-juziwuchuan@juanzenn/ckeditor5-custom-build@lego-js/testsfastlion-picture-viewer@hproinformatica/functions@innodata/vue-v3-ya-metrikagrid-component-react-ex-1@openpolitica/matomo-nextfrdrk-js-semaphore@meysam213/react-leafletfork-react-ffmpegforminput-ui-libflowable-bpmn-modelerfixed_form_buildergentle-fsgit-branching-workflow@icetee/react-recaptcha-v3@kirrosh/ptses-react-bridgeevanutils@sackmanson/quill-image-uploader@saeon/logger@safely-project/safely-ts@parallelnft/web3modal@opn-ooo/eslint-config-opn@ozancakir/ckeditor5-build-inline-balloonguruwayguruway.js@react-18-pdf/root@podlubnaja/ui-kit@positionex/position-sdk@harsha-jalan/ckeditor5-custom-build@hieuquang2212/form@inti-ar/evm-chainsemr-tabulator-tableseffect-protoeditorjs-alerticons
1.0.4

5 years ago

1.0.3

5 years ago