2.0.0 • Published 10 years ago
simple-file-writer v2.0.0
simple file writer
A swiss army file writer. Handles backpressure by buffering. You don't always want to do that.
Data will be written in the order it was fed to the writer.
Extensive tests are included.
###Install
npm install simple-file-writer
###usage example 1 - strings or buffers
var SimpleFileWriter = require('simple-file-writer');
var writer = new SimpleFileWriter('./1.log');
writer.write('yey!');
writer.setupFile('./2.log');
writer.write(new Buffer('yey!'), function() {
console.log('message written');
});
usage example 2 - streams
var SimpleFileWriter = require('simple-file-writer');
var writer = new SimpleFileWriter('./1.log');
var http = require('http');
http.createServer(function(request, response) {
//pipe to file
writer.write(request, function () {
response.end();
});
});
http.listen(8181, function() {
console.log('server listening');
});
usage example 3 - MIX!
var SimpleFileWriter = require('simple-file-writer');
var writer = new SimpleFileWriter('./1.log');
var http = require('http');
http.createServer(function(request, response) {
//pipe to file
writer.write(request, function () {
response.end();
});
writer.write('boo');
writer.write(new Buffer('zzzzzzzzzzzzzzzzz'));
});
http.listen(8181, function() {
console.log('server listening');
});
2.0.0
10 years ago
1.2.0
10 years ago
1.1.1
10 years ago
1.1.0
10 years ago
1.0.9
11 years ago
1.0.8
11 years ago
1.0.6
11 years ago
1.0.5
11 years ago
1.0.4
11 years ago
1.0.3
11 years ago
1.0.2
11 years ago
1.0.1
11 years ago
1.0.0
11 years ago
0.0.6
11 years ago
0.0.5
11 years ago
0.0.3
11 years ago
0.0.2
11 years ago
0.0.1
11 years ago