@git-lazy/康斯特(英语:
Git 子进程执行的常数, 包括防止 ENOBUFS 错误的缓冲大小限制
安装
npm install @git-lazy/const
# or
pnpm add @git-lazy/const
# or
yarn add @git-lazy/const
使用量
import { GitExecMaxBuffer } from '@git-lazy/const';
import { execSync } from 'child_process';
// 執行可能產生大量輸出的 git 命令
// Execute git commands that may produce large output
const output = execSync('git log --all --oneline', {
maxBuffer: GitExecMaxBuffer,
});
API 密码
GitExecMax 缓冲
Git QQ / Git 执行缓冲大小限制常数
防止(緩衝區溢出) git log / 编号 git diff{\fn黑体\fs22\bord1\shad0\3aHBE\4aH00\fscx67\fscy66\2cHFFFFFF\3cH808080}你觉得呢。
防止 ENOBUFS( 缓冲溢出) 在执行 git 子进程时因输出过多出错 。 当 git 命令产生大量输出( 如 git log 或者说 git diff 对于大型寄存器,默认缓冲大小可能不足,导致进程异常终止.
数值 : 104857600 (100甲基溴/ 1024 * 1024 * 100(中文(简体) )
示例
import { GitExecMaxBuffer } from '@git-lazy/const';
import { execSync } from 'child_process';
// 使用 execSync 執行 git 命令
// Execute git command with execSync
const output = execSync('git log --all --oneline', {
maxBuffer: GitExecMaxBuffer,
});
import { GitExecMaxBuffer } from '@git-lazy/const';
import { execa } from 'execa';
// 使用 execa 執行 git 命令
// Execute git command with execa
const { stdout } = await execa('git', ['diff', '--stat'], {
maxBuffer: GitExecMaxBuffer,
});
许可证
公务员制度委员会