0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-29 23:16:30 +01:00
nodejs/test/disabled/test-fs-sendfile.js
2010-02-26 12:20:10 -08:00

27 lines
664 B
JavaScript

process.mixin(require("../common"));
tcp = require("tcp");
sys = require("sys");
var x = path.join(fixturesDir, "x.txt");
var expected = "xyz";
var server = tcp.createServer(function (socket) {
socket.addListener("receive", function (data) {
found = data;
client.close();
socket.close();
server.close();
assert.equal(expected, found);
});
});
server.listen(PORT);
var client = tcp.createConnection(PORT);
client.addListener("connect", function () {
fs.open(x, 'r').addCallback(function (fd) {
fs.sendfile(client.fd, fd, 0, expected.length).addCallback(function (size) {
assert.equal(expected.length, size);
});
});
});