google / zx

A tool for writing better scripts

Home Page:https://npmjs.com/package/zx

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to run "fsutil file createnew" on windows10 system?

wood3n opened this issue · comments

Expected Behavior

run successfully

Actual Behavior

run failed

Steps to Reproduce the Problem

I want to use fsutil file createnew to create large size file on windows10 system, that's my code.

#!/usr/bin/env zx

try {
  // 1GB
  const size = 1024 * 1024 * 1024;
  await $`fsutil file createnew bigfile.txt ${size}`;
} catch (p) {
  console.log(`Exit code: ${p.exitCode}`);
  console.log(`Error: ${p.stderr}`);
}

It will get such a problem

image

Specifications

  • Version: 6.0.1
  • Platform: windows 10 - 19044

https://github.com/google/zx#maxbuffer
So you can override the limit:

$.maxBuffer = 1024 * 1024 * 1024
$`cmd which requires a very large buffer`

https://github.com/google/zx#maxbuffer So you can override the limit:

$.maxBuffer = 1024 * 1024 * 1024
$`cmd which requires a very large buffer`

thank you, but it seems have no effect, still has the same problem.

#!/usr/bin/env zx

try {
  const size = 1024 * 1024 * 1024;
  $.maxBuffer = size;
  // 1GB
  await $`fsutil file createnew bigfile.txt ${size}`;
} catch (p) {
  console.log(`Exit code: ${p.exitCode}`);
  console.log(`Error: ${p.stderr}`);
}

image

Strict limit. I suggest adding a bit more bytes.
Btw, does this util return a new file contets as stdout?

Perhaps the problem is with the quotes. Can you check plz:

fsutil file createnew bigfile.txt 1000
fsutil file createnew bigfile.txt "1000"

@antongolub I just test, it has nothing to do with quotes on windows.😅

ezoic increase your site revenue