Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions docs/src/modules/fs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
description: "Filesystem I/O and metadata operations."
---

# `fs`

Filesystem I/O and metadata operations.

## Usage

```lua
fs = require "mods.fs"

fs.mkdir("tmp/cache/app", true)
```

## Functions

| Function | Description |
| ---------- | -------------------------------------------------- |
| `getcwd` | Alias of `lfs.currentdir` |
| `isblock` | Alias of [`mods.is.block`](/modules/is#fn-block) |
| `ischar` | Alias of [`mods.is.char`](/modules/is#fn-char) |
| `isdevice` | Alias of [`mods.is.device`](/modules/is#fn-device) |
| `isdir` | Alias of [`mods.is.dir`](/modules/is#fn-dir) |
| `isfifo` | Alias of [`mods.is.fifo`](/modules/is#fn-fifo) |
| `isfile` | Alias of [`mods.is.file`](/modules/is#fn-file) |
| `islink` | Alias of [`mods.is.link`](/modules/is#fn-link) |
| `issocket` | Alias of [`mods.is.socket`](/modules/is#fn-socket) |
| `lstat` | Alias of `lfs.symlinkattributes` |
| `rmdir` | Alias of `lfs.rmdir` |
| `stat` | Alias of `lfs.attributes` |
65 changes: 65 additions & 0 deletions docs/src/modules/ntpath.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
description: "Lexical path operations for Windows/NT-style paths."
---

# `ntpath`

Lexical path operations for Windows/NT-style paths.

> 💡Python `ntpath`-style behavior, ported to Lua.

## Usage

```lua
ntpath = require "mods.ntpath"

print(ntpath.join([[C:\]], "Users", "me")) --> "C:\Users\me"
print(ntpath.normcase([[A/B\C]])) --> [[a\b\c]]
print(ntpath.splitdrive([[C:\Users\me]])) --> "C:", [[\Users\me]]
print(ntpath.isreserved([[C:\Temp\CON.txt]])) --> true
```

> ✨ Same API as [`mods.path`](/modules/path), but with Windows/NT path
> semantics.

## Functions

<a id="fn-ismount"></a>

### `ismount(path)`

Return `true` when `path` points to a mount root.

**Parameters**:

- `path` (`string`): Path to inspect.

**Return**:

- `value` (`boolean`): `true` if the path resolves to a mount root.

**Example**:

```lua
ntpath.ismount([[C:\]]) --> true
```

<a id="fn-isreserved"></a>

### `isreserved(path)`

Return `true` when `path` contains a reserved NT filename.

**Parameters**:

- `path` (`string`): Path to inspect.

**Return**:

- `value` (`boolean`): `true` if any component is NT-reserved.

**Example**:

```lua
ntpath.isreserved([[a\CON.txt]]) --> true
```
Loading