Socket
Book a DemoInstallSign in
Socket

pear-user-dirs

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pear-user-dirs

Get the path of user-specific directories

latest
Source
npmnpm
Version
1.0.2
Version published
Weekly downloads
417
76.69%
Maintainers
0
Weekly downloads
 
Created
Source

pear-user-dirs

Get the path of user-specific directories on all major platforms

npm install pear-user-dirs

Usage

Use pear-user-dirs to get the Downloads directory:

const pearUserDirs = require('pear-user-dirs')

pearUserDirs().then(dirs => {
  console.log('Downloads folder path:', dirs.downloads)
})

pearUserDirs({ asFileLinks: true }).then(dirs => {
  console.log('Downloads folder path as URL:', dirs.downloads)
})
const pearUserDirs = require('pear-user-dirs')

const dirs = pearUserDirs({ sync: true })
console.log('Downloads folder path:', dirs.downloads)

const dirsURL = pearUserDirs({ sync: true, asFileLinks: true })
console.log('Downloads folder path as URL:', dirsURL.downloads)

API

pearUserDirs(opts)

  • opts:
    • sync (boolean): If true, directly returns an object with the paths of the user directories, otherwise returns a Promise. Default is false.
    • asFileLinks (boolean): If true, returns the path as a file URL. Default is false.

License

Apache-2.0

FAQs

Package last updated on 07 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts