Skip to content

cityssm/node-windows-unc-path-connect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Windows UNC Path Connect for Node

npm (scoped) DeepSource Maintainability DeepSource 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'
  },
  {
    // Attempt to clean up connection on application shutdown
    deleteOnExit: 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

Security policy

Stars

Watchers

Forks