Skip to content

createFileWithDummy

Requires a Node.js runtime ('qsu/node')

Creates a file with the specified size in bytes. A size of 0 creates an empty file, and a negative size raises an error.

Parameters

NameTypeRequiredDefault
filePathstringStringstr
File or directory path
sizenamedkeywordnumberint
Size of the file to be created (Dummy data is filled as much as the given size)

namedThese parameters are passed as named parameters.

keywordThese parameters are passed as keyword arguments, or as a single dict in their place.

Returns

Promise<boolean>

Future<bool>

bool

Examples

javascript
await createFileWithDummy('/home/user/test.txt', 100000);
// A size of 0 creates an empty file; a negative size throws
await createFileWithDummy('/home/user/empty.txt', 0);
dart
await createFileWithDummy('/home/user/test.txt', size: 100000);
// A size of 0 creates an empty file; a negative size throws
await createFileWithDummy('/home/user/empty.txt', size: 0);
python
createFileWithDummy('/home/user/test.txt', 100000)
# A size of 0 creates an empty file; a negative size raises
createFileWithDummy('/home/user/empty.txt', 0)

Released under the MIT License