0.1.0 • Published 12 years ago

part-file v0.1.0

Weekly downloads
10
License
-
Repository
github
Last release
12 years ago

part-file

Read and write parts to a file with random access support

npm install part-file

usage

var partFile = require('part-file');

var file = part('my-file.txt', 1024, [ // 1024 is the part size
	'sha1 hex of first part',
	'sha1 hex of second part'
]);

file.on('readable', function(partNumber) {
	// when a part becomes readable this event will be called
});

file.write(partNumber, buffer, function(err) {
	// if the hash doesnt match there will be an error
});

file.read(partNumber, function(err, buffer) {
	// if part hasnt been written there will be an error
});