Welcome to Pastey

A lightweight, self-hosted paste platform


Untitled
    # write to file
    try:
        num_bytes = -1
        data = b''
        with io.FileIO(index_path, 'w') as index_file:
            data = html.encode()
            num_bytes = index_file.write(data) # atomic
            if num_bytes != len(data):
                raise Exception('Incomplete Write')
    except Exception as e:
Untitled
    # write to file
    try:
        with io.FileIO(index_path, 'w') as index_file:
            data = html.encode()
            num_bytes = index_file.write(data)
            if num_bytes != len(data):
                raise InterruptedError(f"Only {num_bytes} of {len(data)} written to {index_file}.")
    except OSError as e:
        print('cannot create file %s %s' % (index_path, e))
        return
Untitled
    try:
        import signal
        saved_handler = signal.signal(signal.SIGINT, lambda x, y: print("Finishing filesystem write."))
        with open(index_path, 'w', encoding='utf-8') as index_file:
            index_file.write(html)
    except OSError as e:
        print('cannot create file %s %s' % (index_path, e))
        return
    finally:
        signal.signal(signal.SIGINT, saved_handler)
Untitled
    try:
        with open(index_path, 'w', encoding='utf-8') as index_file:
            index_file.write(html)
    except OSError as e:
        print('cannot create file %s %s' % (index_path, e))
        return
Untitled
Processed 7397942 files, 3307000 regular extents (3874847 refs), 4126895 inline.
Type       Perc     Disk Usage   Uncompressed Referenced
TOTAL       74%      212G         286G         308G
none       100%      183G         183G         168G
zstd        28%       29G         103G         140G