Skip to content

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

License

Notifications You must be signed in to change notification settings

cityssm/node-windows-unc-path-connect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 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) {}