PurePath.withStem() method
pathlib-ts > PurePath > withStem
PurePath.withStem() method
Section titled “PurePath.withStem() method”Returns a new path with the stem component changed.
Signature:
withStem(stem: string): PurePath;Parameters
Section titled “Parameters”|
Parameter |
Type |
Description |
|---|---|---|
|
stem |
string |
New stem string. |
Returns:
A new path where the last component has the provided stem.
Exceptions
Section titled “Exceptions”The Error class If the path has a suffix and stem is empty.
Remarks
Section titled “Remarks”The current suffix is preserved. Passing an empty stem is only allowed when the path has no suffix, matching CPython behaviour.