-
-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2ba530f
commit 8a8d3f2
Showing
9 changed files
with
161 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--- | ||
title: Neutralino.server | ||
toc_max_heading_level: 2 | ||
--- | ||
|
||
`Neutralino.server` namespace offers functions to map local filesystem directories to the static server as a secure alternative for the `file://` protocol. | ||
|
||
|
||
## server.mount(path, target) | ||
Mounts a local directory. Throws `NE_FS_NOPATHE` and `NE_FS_NOTADIR` for invalid targets and `NE_SR_MPINUSE` if the path is already mounted. | ||
|
||
### Parameters | ||
|
||
- `path` String: Resource path. | ||
- `target` String: A directory in the local filesystem. | ||
|
||
```js | ||
await Neutralino.server.mount('/app-res', NL_PATH + '/app-res'); | ||
await fetch('/app-res/myFile.txt'); // loads NL_PATH + '/app-res/myFile.txt' | ||
``` | ||
|
||
## server.unmount(path) | ||
Deactivates a mount configuration. Throws `NE_SR_NOMTPTH` if the provided path is not mounted. | ||
|
||
### Parameters | ||
|
||
- `path` String: Resource path. | ||
|
||
```js | ||
await Neutralino.server.mount('/app-res', NL_PATH + '/app-res'); | ||
``` | ||
|
||
## server.getMounts() | ||
Lists mount configurations. | ||
|
||
### Return Object (awaited): | ||
Directory mount map that stores each configuration entry as a key-value pair. | ||
|
||
|
||
```js | ||
let mounts = await Neutralino.server.getMounts(); | ||
console.log('Mounts:', mounts); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters