Home Contents | # rawio:truncate | Rawio | Core4 Lua Event System

## SYNOPSIS

handle:truncate(offset)

## DESCRIPTION

rawio:truncate() resizes the file to offset bytes of length.

If offset is less than the previous length, any data behind it is discarded.

Conversely, with offset being larger than the previous length, the size of the file is increased and the added space is filled with zeroes.

## RETURN VALUE

On success, returns true. On failure, returns nil. In case of an error, the error can be retrieved using rawio:lastError().

## SEE ALSO

rawio.attach, rawio:blocking, rawio:canReadLine, rawio:clearError, rawio:close, rawio:connect, rawio:detach, rawio:lastError, rawio:line, rawio:lines, rawio.access, rawio.open, rawio:read, rawio:copy, rawio.stat, rawio.statfs, rawio:writet, rawio:write