Skip to content

Commit

Permalink
doc: update interface
Browse files Browse the repository at this point in the history
  • Loading branch information
criyle committed Feb 6, 2024
1 parent 581b925 commit 39b6035
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 2 deletions.
32 changes: 31 additions & 1 deletion README.cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,20 @@ interface Symlink {
symlink: string; // 符号连接目标 (v1.6.0+)
}

interface StreamIn {
streamIn: boolean; // 流式输入 (v1.8.1+)
}

interface StreamOut {
streamOut: boolean; // 流式输出 (v1.8.1+)
}

interface Cmd {
args: string[]; // 程序命令行参数
env?: string[]; // 程序环境变量

// 指定 标准输入、标准输出和标准错误的文件
files?: (LocalFile | MemoryFile | PreparedFile | Collector)[];
files?: (LocalFile | MemoryFile | PreparedFile | Collector | StreamIn | StreamOut)[];
tty?: boolean; // 开启 TTY (需要保证标准输出和标准错误为同一文件)同时需要指定 TERM 环境变量 (例如 TERM=xterm)

// 资源限制
Expand Down Expand Up @@ -167,6 +175,28 @@ interface WSResult {
results: Result[];
error?: string;
}

// 流式请求 / 响应
interface Resize {
index: number;
fd: number;
rows: number;
cols: number;
x: number;
y: number;
}

interface Input {
index: number;
fd: number;
content: Buffer;
}

interface Output {
index: number;
fd: number;
content: Buffer;
}
```

### 示例
Expand Down
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,20 @@ interface Symlink {
symlink: string; // symlink destination (v1.6.0+)
}

interface StreamIn {
streamIn: boolean; // stream input (v1.8.1+)
}

interface StreamOut {
streamOut: boolean; // stream output (v1.8.1+)
}

interface Cmd {
args: string[]; // command line argument
env?: string[]; // environment

// specifies file input / pipe collector for program file descriptors
files?: (LocalFile | MemoryFile | PreparedFile | Collector)[];
files?: (LocalFile | MemoryFile | PreparedFile | Collector | StreamIn | StreamOut)[];
tty?: boolean; // enables tty on the input and output pipes (should have just one input & one output)
// Notice: must have TERM environment variables (e.g. TERM=xterm)

Expand Down Expand Up @@ -173,6 +181,28 @@ interface WSResult {
results: Result[];
error?: string;
}

// Stream request & responses
interface Resize {
index: number;
fd: number;
rows: number;
cols: number;
x: number;
y: number;
}

interface Input {
index: number;
fd: number;
content: Buffer;
}

interface Output {
index: number;
fd: number;
content: Buffer;
}
```

### Example Request & Response
Expand Down

0 comments on commit 39b6035

Please sign in to comment.