{"id":18065580,"url":"https://github.com/larrybahr/windows-network-drive","last_synced_at":"2025-04-11T18:41:11.582Z","repository":{"id":37733222,"uuid":"89618642","full_name":"larrybahr/windows-network-drive","owner":"larrybahr","description":"Do network drive stuff on Microsoft Window in node","archived":false,"fork":false,"pushed_at":"2022-12-30T23:32:35.000Z","size":310,"stargazers_count":25,"open_issues_count":3,"forks_count":6,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T22:37:22.901Z","etag":null,"topics":["mount","network-drive","node","node-js","nodejs","npm","npm-module","npm-package","windows"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/larrybahr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-27T16:32:30.000Z","updated_at":"2025-03-12T04:20:55.000Z","dependencies_parsed_at":"2023-01-31T17:16:09.622Z","dependency_job_id":null,"html_url":"https://github.com/larrybahr/windows-network-drive","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/larrybahr%2Fwindows-network-drive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/larrybahr%2Fwindows-network-drive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/larrybahr%2Fwindows-network-drive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/larrybahr%2Fwindows-network-drive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/larrybahr","download_url":"https://codeload.github.com/larrybahr/windows-network-drive/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247881849,"owners_count":21011943,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mount","network-drive","node","node-js","nodejs","npm","npm-module","npm-package","windows"],"created_at":"2024-10-31T06:10:46.637Z","updated_at":"2025-04-11T18:41:11.527Z","avatar_url":"https://github.com/larrybahr.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# windows-network-drive\n\nAllows a user to do network drive stuff on Microsoft Windows from node js\n\n[See release notes for breaking changes and migration info](https://github.com/larrybahr/windows-network-drive/releases)\n\n## Installation\n\n```bash\n$ npm install windows-network-drive\n```\n## Features\n\n* Mount a network drive that will persist after reboot\n* Unmount a network drive\n* Get a list of all network drives\n* Find if a path is already mounted and get the drive letter\n* Convert Unix paths to Windows friendly paths\n* TypeScript types included\n\n## Methods\n\nAll examples assume:\n\n```javascript\nlet networkDrive = require('windows-network-drive');\n```\n\n### find\nFinds if a path is already mounted and returns all drive letters that point to that exact path.\n```typescript\nfind(drivePath: string): Promise\u003c{status: boolean, driveLetter: string, path: string, statusMessage: string}[]\u003e\n```\n\n#### Examples\n\n```javascript\n networkDrive.find(\"\\\\\\\\DoesExist\\\\Path\")\n .then(function (result)\n {\n\t // result === [{status: true, driveLetter: \"Z\", path: \"\\\\\\\\DoesExist\\\\Path\", \"statusMessage\": \"OK\"}]\n });\n\n  networkDrive.find(\"\\\\\\\\DoesExist\\\\Path\\\\ThisFolderIsNotPartOfTheMountPath\")\n .then(function (driveLetter)\n {\n\t // driveLetter === []\n });\n\n networkDrive.find(\"\\\\\\\\DoesNOTExist\\\\Path\")\n .then(function (driveLetter)\n {\n\t // driveLetter === []\n });\n```\n\n### list\nList all network drives and their paths.\n```typescript\nlist(void): Promise\u003cobject\u003e\n```\n\n#### Examples\n\n```javascript\n // With network drives\n networkDrive.list()\n .then(function (drives)\n {\n\t /*\n\t\tdrives = {\n\t\t\t\"F\": { \"status\": true, \"driveLetter\": \"F\", \"path\": \"\\\\\\\\NETWORKA\\\\Files\", \"statusMessage\": \"OK\" },\n\t\t\t\"K\": { \"status\": true, \"driveLetter\": \"K\", \"path\": \"\\\\\\\\NETWORKB\\\\Files\", \"statusMessage\": \"OK\" }\n\t\t}\n\t*/\n });\n\n // No network drives\n networkDrive.list()\n .then(function (drives)\n {\n\t // drives = {}\n });\n```\n\n### mount\nMounts a network drive path and returns the new drive letter.\n```typescript\nmount(drivePath: string, driveLetter?: string, username?: string, password?: string): Promise\u003cstring\u003e\n```\n\n#### Examples\n\n```javascript\n networkDrive.mount(\"\\\\\\\\DoesExist\\\\Path\\\\Files\", \"F\", undefined, undefined)\n .then(function (driveLetter)\n {\n\t // driveLetter = \"F\"\n });\n```\n\n### unmount\nUnmounts a network drive.\n```typescript\nunmount(driveLetter: string): Promise\u003cvoid\u003e\n```\n\n#### Examples\n\n```javascript\n networkDrive.unmount(\"F\")\n .then(function ()\n {\n\t // done\n });\n```\n\n### pathToWindowsPath\nConverts a valid file system path to a Windows friendly path.\n\nNOTE: All methods can take in a non Windows friendly path. This is exported for user convenience.\n```typescript\npathToWindowsPath(drivePath: string): Promise\u003cstring\u003e\n```\n\n#### Examples\n\n```javascript\n networkDrive.pathToWindowsPath(\"//DoesExist/Path/Files\")\n .then(function (windowsPath)\n {\n\t // windowsPath = \\\\\\\\DoesExist\\\\Path\\\\Files\n });\n```\n\n### isWinOs\nTest the current OS is Windows.\n\n```typescript\nisWinOs(void): boolean\n```\n\n#### Examples\n\n```javascript\n if (true ===networkDrive.isWinOs())\n {\n\t console.log(\"This is running on Windows\");\n }\n```\n\n## More Examples\n\nFor more examples, check out the [example](https://github.com/larrybahr/windows-network-drive/tree/master/example) folder in the GitHub repo!\n\n## Tests\n\n  To run the test suite, first install the dependencies, then run `npm test`:\n\n```bash\n$ npm install\n$ npm test\n```\n\n## Contributing\n\nIn lieu of a formal style guide, take care to maintain the existing coding style.\n* Format code with VS Code, using the default \"Typescript and JavaScript Language Features\" formatter.\n* Add unit tests for any new or changed functionality.\n* Lint and test your code.\n\n## People\n\nAuthor and list of all contributors can be found in [package.json](package.json)\n\n## License\n\n  [MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flarrybahr%2Fwindows-network-drive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flarrybahr%2Fwindows-network-drive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flarrybahr%2Fwindows-network-drive/lists"}