Skip to content

cityssm/node-windows-unc-path-connect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Windows UNC Path Connect for Node

npm (scoped) DeepSource codecov Coverage Testing

Ensures a UNC path that requires a user name and password is ready to use in Windows before use.

Installation

npm install @cityssm/windows-unc-path-connect

Usage

import { connectToUncPath } from '@cityssm/windows-unc-path-connect'

const uncPath = '\\\\server\\fileShare'

/*
 * Connect to share
 */

const success = connectToUncPath(
  {
    uncPath,
    userName: 'user',
    password: 'p@ss'
  },
  {
    // Optionally attempt to clean up connection on application shutdown.
    deleteOnExit: true,

    // Optionally assign a drive letter.
    driveLetter: 'M:',

    // Optionally persist the connection after restart.
    persistent: true
  }
)

/*
 * Reading files should now work.
 */

try {
  const files = await fs.readdir(uncPath)
} catch (error) {}

About

Ensures a UNC path that requires a user name and password is ready to use in Windows before use.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Contributors