All Projects → larrybahr → windows-network-drive

larrybahr / windows-network-drive

Licence: MIT license
Do network drive stuff on Microsoft Window in node

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to windows-network-drive

Rando.js
The world's easiest, most powerful random function.
Stars: ✭ 659 (+3561.11%)
Mutual labels:  npm-package, npm-module, node-js
express-mvc-generator
Express' Model View Controller Application Generator.
Stars: ✭ 46 (+155.56%)
Mutual labels:  npm-package, npm-module, node-js
Node Loadbalance
A collection of distilled load balancing engines
Stars: ✭ 79 (+338.89%)
Mutual labels:  npm-package, npm-module, node-js
arcscord
A Discord library written in typescript
Stars: ✭ 18 (+0%)
Mutual labels:  npm-package, npm-module, node-js
Forge Node App
🛠📦🎉 Generate Node.js boilerplate with optional libraries & tools
Stars: ✭ 90 (+400%)
Mutual labels:  npm-package, npm-module, node-js
Jsonexport
{} → 📄 it's easy to convert JSON to CSV
Stars: ✭ 208 (+1055.56%)
Mutual labels:  npm-package, npm-module
Abort Controller
An implementation of WHATWG AbortController interface.
Stars: ✭ 213 (+1083.33%)
Mutual labels:  npm-package, npm-module
Ts ci
✅ Continuous integration setup for TypeScript projects via GitHub Actions.
Stars: ✭ 225 (+1150%)
Mutual labels:  npm-package, npm-module
json-as-xlsx
Create excel from json npm package
Stars: ✭ 103 (+472.22%)
Mutual labels:  npm-module, node-js
Homebridge Wol
A Wake on Lan plugin for Homebridge
Stars: ✭ 150 (+733.33%)
Mutual labels:  npm-package, npm-module
Singlespotify
🎵 Create Spotify playlists based on one artist through the command line
Stars: ✭ 254 (+1311.11%)
Mutual labels:  npm-package, npm-module
js-stack-from-scratch
🌺 Russian translation of "JavaScript Stack from Scratch" from the React-Theming developers https://github.com/sm-react/react-theming
Stars: ✭ 394 (+2088.89%)
Mutual labels:  npm-package, npm-module
Darkmode.js
🌓 Add a dark-mode / night-mode to your website in a few seconds
Stars: ✭ 2,339 (+12894.44%)
Mutual labels:  npm-package, npm-module
Node Regedit
Read, Write, List and do all sorts of funky stuff to the windows registry using node.js and windows script host
Stars: ✭ 178 (+888.89%)
Mutual labels:  npm-package, npm-module
Eslint Plugin Eslint Comments
Additional ESLint rules for directive comments of ESLint.
Stars: ✭ 221 (+1127.78%)
Mutual labels:  npm-package, npm-module
Reactopt
A CLI React performance optimization tool that identifies potential unnecessary re-rendering
Stars: ✭ 1,975 (+10872.22%)
Mutual labels:  npm-package, npm-module
ifto
A simple debugging module for AWS Lambda (λ) timeout
Stars: ✭ 72 (+300%)
Mutual labels:  npm-module, node-js
MinifyAllCli
📦 A lightweight, simple and easy npm tool to 𝗺𝗶𝗻𝗶𝗳𝘆 JSON/C, HTML and CSS! Also known as MinifyAll core! ⭐ Usable as 𝑪𝑳𝑰 tool or 𝒊𝒎𝒑𝒐𝒓𝒕𝒂𝒃𝒍𝒆 in TS/JS as a 𝑴𝑶𝑫𝑼𝑳𝑬 🥰
Stars: ✭ 21 (+16.67%)
Mutual labels:  npm-package, npm-module
micro-signals
A tiny typed messaging system inspired by js-signals that uses ES2015 sets
Stars: ✭ 39 (+116.67%)
Mutual labels:  npm-package, npm-module
react-folder-tree
A versatile react treeview library that supports custom icons and event handlers
Stars: ✭ 56 (+211.11%)
Mutual labels:  npm-package, npm-module

windows-network-drive

Allows a user to do network drive stuff on Microsoft Windows from node js

See release notes for breaking changes and migration info

Installation

$ npm install windows-network-drive

Features

  • Mount a network drive that will persist after reboot
  • Unmount a network drive
  • Get a list of all network drives
  • Find if a path is already mounted and get the drive letter
  • Convert Unix paths to Windows friendly paths
  • TypeScript types included

Methods

All examples assume:

let networkDrive = require('windows-network-drive');

find

Finds if a path is already mounted and returns all drive letters that point to that exact path.

find(drivePath: string): Promise<{status: boolean, driveLetter: string, path: string, statusMessage: string}[]>

Examples

 networkDrive.find("\\\\DoesExist\\Path")
 .then(function (result)
 {
	 // result === [{status: true, driveLetter: "Z", path: "\\\\DoesExist\\Path", "statusMessage": "OK"}]
 });

  networkDrive.find("\\\\DoesExist\\Path\\ThisFolderIsNotPartOfTheMountPath")
 .then(function (driveLetter)
 {
	 // driveLetter === []
 });

 networkDrive.find("\\\\DoesNOTExist\\Path")
 .then(function (driveLetter)
 {
	 // driveLetter === []
 });

list

List all network drives and their paths.

list(void): Promise<object>

Examples

 // With network drives
 networkDrive.list()
 .then(function (drives)
 {
	 /*
		drives = {
			"F": { "status": true, "driveLetter": "F", "path": "\\\\NETWORKA\\Files", "statusMessage": "OK" },
			"K": { "status": true, "driveLetter": "K", "path": "\\\\NETWORKB\\Files", "statusMessage": "OK" }
		}
	*/
 });

 // No network drives
 networkDrive.list()
 .then(function (drives)
 {
	 // drives = {}
 });

mount

Mounts a network drive path and returns the new drive letter.

mount(drivePath: string, driveLetter?: string, username?: string, password?: string): Promise<string>

Examples

 networkDrive.mount("\\\\DoesExist\\Path\\Files", "F", undefined, undefined)
 .then(function (driveLetter)
 {
	 // driveLetter = "F"
 });

unmount

Unmounts a network drive.

unmount(driveLetter: string): Promise<void>

Examples

 networkDrive.unmount("F")
 .then(function ()
 {
	 // done
 });

pathToWindowsPath

Converts a valid file system path to a Windows friendly path.

NOTE: All methods can take in a non Windows friendly path. This is exported for user convenience.

pathToWindowsPath(drivePath: string): Promise<string>

Examples

 networkDrive.pathToWindowsPath("//DoesExist/Path/Files")
 .then(function (windowsPath)
 {
	 // windowsPath = \\\\DoesExist\\Path\\Files
 });

isWinOs

Test the current OS is Windows.

isWinOs(void): boolean

Examples

 if (true ===networkDrive.isWinOs())
 {
	 console.log("This is running on Windows");
 }

More Examples

For more examples, check out the example folder in the GitHub repo!

Tests

To run the test suite, first install the dependencies, then run npm test:

$ npm install
$ npm test

Contributing

In lieu of a formal style guide, take care to maintain the existing coding style.

  • Format code with VS Code, using the default "Typescript and JavaScript Language Features" formatter.
  • Add unit tests for any new or changed functionality.
  • Lint and test your code.

People

Author and list of all contributors can be found in package.json

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].