aboutsummaryrefslogtreecommitdiffstats
path: root/dump_chunkfile.py
blob: 84fbfaccd0cde980936f906ef217353ef2598587 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env python

import FuseArchive.ChunkFile, sys, re, os

# Run this in the storage area, basically 'cat' the file
file = re.sub( '^.*?tree', '', sys.argv[ 1 ] )
sys.stderr.write( "Opening file: %s\n" % file )

f = FuseArchive.ChunkFile.ChunkFile( file, os.O_RDONLY, 0 )

sys.stderr.write( "File is: %d bytes\n" % f.size )

offset = 0
blocksize = 4096
while offset <= f.size:
    data = f.read( blocksize, offset )
    sys.stdout.write( data )
    offset += blocksize