feat: Allow usage of an absolute path for partitions used in a session (#37604)
* Allow an absolute path to be used for creating sessions Allows an absolute path to be used for creating sessions by adding the session.fromPath() API. * Fixup! Clarify that an emptry string is not permitted as a parameter to fromPath()
This commit is contained in:
parent
eb613ef3d4
commit
e0c348a2f8
8 changed files with 153 additions and 18 deletions
|
@ -42,6 +42,22 @@ To create a `Session` with `options`, you have to ensure the `Session` with the
|
|||
`partition` has never been used before. There is no way to change the `options`
|
||||
of an existing `Session` object.
|
||||
|
||||
### `session.fromPath(path[, options])`
|
||||
|
||||
* `path` string
|
||||
* `options` Object (optional)
|
||||
* `cache` boolean - Whether to enable cache.
|
||||
|
||||
Returns `Session` - A session instance from the absolute path as specified by the `path`
|
||||
string. When there is an existing `Session` with the same absolute path, it
|
||||
will be returned; otherwise a new `Session` instance will be created with `options`. The
|
||||
call will throw an error if the path is not an absolute path. Additionally, an error will
|
||||
be thrown if an empty string is provided.
|
||||
|
||||
To create a `Session` with `options`, you have to ensure the `Session` with the
|
||||
`path` has never been used before. There is no way to change the `options`
|
||||
of an existing `Session` object.
|
||||
|
||||
## Properties
|
||||
|
||||
The `session` module has the following properties:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue