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-rsjeuxuijesusdemojamuskalimjameslinenode.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@parallelnft/web3modal@openpolitica/matomo-next@oriduk/ckeditor5-rebuild-musicanote@oriduk/ckeditor5-rebuild-oriduk@opn-ooo/eslint-config-opn@hproinformatica/functions@hoaitt/ckeditor5-build-classic-mention@hieuquang2212/form@innodata/vue-v3-ya-metrika@inesfidalgo/forge@inti-ar/evm-chains@icetee/react-recaptcha-v3@ikon-x/ckeditor5-custom-build-for-irrosoft@podlubnaja/ui-kit@poondestroyer/sig@positionex/position-sdk@percent/percent-api-hooks@ozancakir/ckeditor5-build-inline-balloon@plogg/threegentle-fsfrdrk-js-semaphoreforminput-ui-libfn-lib-examplefork-react-ffmpeg@shivarajapple/first-library@ssossou/styletool@swiizyyy/discord-akairo@taymoon/ckeditor5-custom-buildeditorjs-alerticonseffect-protoes-react-bridgeemr-tabulator-tableseslint-config-k3cman-angularera-ckeditor5evanutilsfastlion-picture-viewer
1.0.4

6 years ago

1.0.3

6 years ago