def truncate(path, length):
    path = os.path.expanduser(path)
    with salt.utils.fopen(path, 'rb+') as seek_fh:
        seek_fh.truncate(int(length))
.. versionadded:: 2014.1.0
dataset/ETHPy150Open saltstack/salt/salt/modules/file.py/truncate