file-paths-win32

1.0.0 • Public • Published

file-paths-win32 NPM version js-standard-style

Find paths of files matching file name on Windows

install

$ npm install --save file-paths-win32

api

returns

Promise is returned with

  • resolve (array) [Array of file paths, empty if not found]
  • reject (error)

arguments

  • filename(s) (string || array)
  • opts (object) optional
    • hints (array - %HOMEPATH% unless file is EXE) [paths to search]
    • full (boolean - false) [search all drives recursively]

usage

const filePaths = require('file-paths-win32')
let fpOpts
 
// search for single file in default paths
filePaths('someFile.txt').then(console.log).catch(console.error)
 
// search for single EXE in default executable paths
filePaths('someApp.exe').then(console.log).catch(console.error)
 
// search for array of files in default paths
filePaths(['someFile.txt', 'someApp.exe']).then(console.log).catch(console.error)
 
// search for single file in specific paths
fpOpts = {hints: ['C:\\some\\path', 'C:\\some\\other\\path\\']}
filePaths('someFile', fpOpts).then(console.log).catch(console.error)
 
// search for single file in all drives recursively
fpOpts = {full: true}
filePaths('someFile', fpOpts).then(console.log).catch(console.error)

License

MIT © Andrew Carpenter

Package Sidebar

Install

npm i file-paths-win32

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • doesdev