Paths
Paths in the Webnative SDK
Webnative uses directory and file paths built from path segments by path functions.
1
// creates a directory path equivalent to "public/some/directory/"
2
const publicDirectoryPath = wn.path.directory("public", "some", "directory")
3
​
4
// creates a directory path equivalent to "private/some/directory/"
5
const privateDirectoryPath = wn.path.directory("private", "some", "directory")
6
​
7
// creates a file path equivalent to "public/some/file"
8
const publicFilePath = wn.path.file("public", "some", "file")
9
​
10
// creates a file path equivalent to "private/some/file"
11
const privateFilePath = wn.path.file("private", "some", "file")
12
​
13
// wn.path.Branch.Private is an alias for "private"
14
const privateHelperPath = wn.path.file(wn.path.Branch.Private, "some", "file")
15
​
16
// wn.path.Branch.Public is an alias for "public"
17
const publicHelperPath = wn.path.file(wn.path.Branch.Public, "some", "file")
Copied!
All webnative SDK methods expect paths created by path functions. See the path API documentation for more path utility functions.
Path Objects. The path functions create objects like { directory: ["public", "some", "directory"] } or { file: ["public", "some", "file"] }. We recommend you use path functions because they validate paths to make sure they are well-formed.
Last modified 3mo ago
Export as PDF
Copy link