0.0.33 • Published 6 years ago

util.home v0.0.33

Weekly downloads
24
License
MIT
Repository
github
Last release
6 years ago

util.home

Expands the ~ home directory in a path

build analysis code style: prettier testing NPM

Path strings that use the ~, ~/ or ~\ at the front of the string will be expanded to use the home directory of the user. The home directory is dependent on the architecture. For Linux/OSX the environment variable HOME is used. On the Windows operating system it uses USERPROFILE.

This module uses typescript and has a type definition file supplied with the package. It will also accept a Buffer or string.

This module was inspired by the expand-home-dir package.

Installation

This module uses yarn to manage dependencies and run scripts for development.

To install as an application dependency:

$ yarn add --dev util.home

To build the app and run all tests:

$ yarn run all

Usage

Windows

let expand = require('util.home').expandHomeDirectory;

// With USERPROFILE = 'C:\Users\foo'
let dir = expand('~/Documents');
console.log(dir);  // dir = 'C:\Users\foo\Documents'

Linux/OSX

let expand = require('util.home').expandHomeDirectory;

// With HOME = '/home/foo`'
let dir = expand('~/documents');
console.log(dir);  // dir = '/home/foo/documents'
0.0.33

6 years ago

0.0.32

6 years ago

0.0.31

6 years ago

0.0.30

6 years ago

0.0.29

6 years ago

0.0.28

6 years ago

0.0.27

6 years ago

0.0.26

6 years ago

0.0.25

6 years ago

0.0.24

7 years ago

0.0.23

7 years ago

0.0.22

8 years ago

0.0.21

8 years ago

0.0.20

8 years ago

0.0.19

8 years ago

0.0.18

8 years ago

0.0.17

8 years ago

0.0.16

8 years ago

0.0.15

8 years ago

0.0.14

8 years ago

0.0.13

8 years ago

0.0.12

8 years ago

0.0.11

8 years ago

0.0.10

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago