0.1.0 • Published 24 days ago

@cityssm/windows-unc-path-connect v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
24 days ago

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

24 days ago