|
1 | | -# {{ NAME }} |
| 1 | +# MemoryMappedFile |
2 | 2 |
|
3 | | -{{ DESCRIPTION }} |
| 3 | +MemoryMappedFile is a PowerShell module for creating, reading, writing, and closing named memory-mapped files. |
4 | 4 |
|
5 | 5 | ## Prerequisites |
6 | 6 |
|
7 | | -This uses the following external resources: |
8 | | -- The [PSModule framework](https://github.com/PSModule/Process-PSModule) for building, testing and publishing the module. |
| 7 | +- PowerShell with `Microsoft.PowerShell.PSResourceGet` available for `Install-PSResource`. |
| 8 | +- The [PSModule framework](https://github.com/PSModule) is used for building, testing, and publishing the module. |
9 | 9 |
|
10 | 10 | ## Installation |
11 | 11 |
|
12 | | -To install the module from the PowerShell Gallery, you can use the following command: |
| 12 | +Install the module from the PowerShell Gallery: |
13 | 13 |
|
14 | 14 | ```powershell |
15 | | -Install-PSResource -Name {{ NAME }} |
16 | | -Import-Module -Name {{ NAME }} |
| 15 | +Install-PSResource -Name MemoryMappedFile |
| 16 | +Import-Module -Name MemoryMappedFile |
17 | 17 | ``` |
18 | 18 |
|
19 | | -## Usage |
| 19 | +## Commands |
20 | 20 |
|
21 | | -Here is a list of example that are typical use cases for the module. |
| 21 | +- `New-MemoryMappedFile` creates a named memory-mapped file from a backing file path. |
| 22 | +- `Set-MemoryMappedFile` returns an existing map by name or creates it when missing. |
| 23 | +- `Get-MemoryMappedFile` opens an existing named map. |
| 24 | +- `Set-MemoryMappedFileContent` writes UTF-8 string content to a named map. |
| 25 | +- `Read-MemoryMappedFileContent` reads UTF-8 string content from a named map. |
| 26 | +- `Show-MemoryMappedFile` displays map content repeatedly in the console. |
| 27 | +- `Close-MemoryMappedFile` disposes a named map. |
22 | 28 |
|
23 | | -### Example 1: Greet an entity |
| 29 | +## Usage |
24 | 30 |
|
25 | | -Provide examples for typical commands that a user would like to do with the module. |
| 31 | +Create or open a map backed by a file: |
26 | 32 |
|
27 | 33 | ```powershell |
28 | | -Greet-Entity -Name 'World' |
29 | | -Hello, World! |
| 34 | +Set-MemoryMappedFile -Name 'SharedMap' -Path './shared.dat' -Size 2MB |
30 | 35 | ``` |
31 | 36 |
|
32 | | -### Example 2 |
33 | | - |
34 | | -Provide examples for typical commands that a user would like to do with the module. |
| 37 | +Write and read string content: |
35 | 38 |
|
36 | 39 | ```powershell |
37 | | -Import-Module -Name PSModuleTemplate |
| 40 | +Set-MemoryMappedFileContent -Name 'SharedMap' -Path './shared.dat' -Content 'Hello from PowerShell' |
| 41 | +Read-MemoryMappedFileContent -Name 'SharedMap' |
38 | 42 | ``` |
39 | 43 |
|
40 | | -### Find more examples |
| 44 | +Close the map when finished: |
| 45 | + |
| 46 | +```powershell |
| 47 | +Close-MemoryMappedFile -Name 'SharedMap' |
| 48 | +``` |
41 | 49 |
|
42 | | -To find more examples of how to use the module, please refer to the [examples](examples) folder. |
| 50 | +## Examples |
43 | 51 |
|
44 | | -Alternatively, you can use the Get-Command -Module 'This module' to find more commands that are available in the module. |
45 | | -To find examples of each of the commands you can use Get-Help -Examples 'CommandName'. |
| 52 | +More usage examples are available in the [examples](examples) folder. |
46 | 53 |
|
47 | 54 | ## Documentation |
48 | 55 |
|
49 | | -Link to further documentation if available, or describe where in the repository users can find more detailed documentation about |
50 | | -the module's functions and features. |
| 56 | +Command documentation is published at [psmodule.io/MemoryMappedFile](https://psmodule.io/MemoryMappedFile/). |
51 | 57 |
|
52 | 58 | ## Contributing |
53 | 59 |
|
54 | | -Coder or not, you can contribute to the project! We welcome all contributions. |
55 | | - |
56 | | -### For Users |
57 | | - |
58 | | -If you don't code, you still sit on valuable information that can make this project even better. If you experience that the |
59 | | -product does unexpected things, throw errors or is missing functionality, you can help by submitting bugs and feature requests. |
60 | | -Please see the issues tab on this project and submit a new issue that matches your needs. |
61 | | - |
62 | | -### For Developers |
63 | | - |
64 | | -If you do code, we'd love to have your contributions. Please read the [Contribution guidelines](CONTRIBUTING.md) for more information. |
65 | | -You can either help by picking up an existing issue or submit a new one if you have an idea for a new feature or improvement. |
66 | | - |
67 | | -## Acknowledgements |
68 | | - |
69 | | -Here is a list of people and projects that helped this project in some way. |
| 60 | +Issues and pull requests are welcome. Please use the repository issue tracker to report bugs, request features, or discuss improvements. |
0 commit comments