Save PodeState - mdaneri/Pode GitHub Wiki
Saves the current Pode server state to a JSON file.
Save-PodeState [-Path] <String> [[-Scope] <String[]>] [[-Exclude] <String[]>] [[-Include] <String[]>]
[[-Depth] <Int16>] [-Compress] [-ProgressAction <ActionPreference>] [<CommonParameters>]
This function serializes the Pode state into a JSON file while preserving the structure of dictionaries (`ConcurrentDictionary`, `Hashtable`, `OrderedDictionary`). It allows filtering the saved state by scope, inclusion, or exclusion of specific keys.
For thread safety, it is recommended to wrap this function inside a `Lock-PodeObject` block.
Save-PodeState -Path './state.json'
Saves the entire Pode state to `state.json`.
Save-PodeState -Path './state.json' -Exclude 'SessionData', 'UserCache'
Saves the Pode state but **excludes** the specified state keys.
Save-PodeState -Path './state.json' -Scope 'Users'
Saves **only** state objects that belong to the `"Users"` scope.
If specified, the JSON output will be minified (no extra whitespace).
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseDefines the maximum depth for JSON serialization. This value is passed to `ConvertTo-PodeCustomDictionaryJson`. Default is 20.
Type: Int16
Parameter Sets: (All)
Aliases:
Required: False
Position: 5
Default value: 20
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies state object names to exclude from being saved. This filter has higher precedence than Include.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies state object names to only include in the saved state. This filter has lower precedence than Exclude.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies the file path where the state should be saved.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False{{ Fill ProgressAction Description }}
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseFilters the state objects to be saved based on their scope. Only state objects within the specified scope(s) will be included. This filter has lower precedence than Exclude and Include.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
- This function is intended for internal Pode usage and may be subject to changes.
- For more information, refer to: https://github.com/Badgerati/Pode/tree/develop