RosettaCodeData/Task/Truncate-a-file/Sidef/truncate-a-file.sidef
2023-07-01 13:44:08 -04:00

9 lines
253 B
Text

func truncate(filename, len) {
var file = File(filename);
len > file.size ->
&& die "The provided length is greater than the length of the file";
file.truncate(len);
}
# truncate "file.ext" to 1234 bytes
truncate("file.ext", 1234);