diff --git a/lib/fs.js b/lib/fs.js index c8e44e1d7c5..ee918b49aa0 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -609,14 +609,6 @@ fs.mkdirSync = function(path, mode) { modeNum(mode, 511 /*=0777*/)); }; -fs.sendfile = function(outFd, inFd, inOffset, length, callback) { - binding.sendfile(outFd, inFd, inOffset, length, makeCallback(callback)); -}; - -fs.sendfileSync = function(outFd, inFd, inOffset, length) { - return binding.sendfile(outFd, inFd, inOffset, length); -}; - fs.readdir = function(path, callback) { callback = makeCallback(callback); if (!nullCheck(path, callback)) return; diff --git a/src/node_file.cc b/src/node_file.cc index 714a18c9411..9e43961266e 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -144,8 +144,6 @@ static void After(uv_fs_t *req) { break; case UV_FS_OPEN: - /* pass thru */ - case UV_FS_SENDFILE: argv[1] = Integer::New(req->result); break; @@ -603,30 +601,6 @@ static Handle MKDir(const Arguments& args) { } } -static Handle SendFile(const Arguments& args) { - HandleScope scope; - - if (args.Length() < 4 || - !args[0]->IsUint32() || - !args[1]->IsUint32() || - !args[2]->IsUint32() || - !args[3]->IsUint32()) { - return THROW_BAD_ARGS; - } - - int out_fd = args[0]->Uint32Value(); - int in_fd = args[1]->Uint32Value(); - off_t in_offset = args[2]->Uint32Value(); - size_t length = args[3]->Uint32Value(); - - if (args[4]->IsFunction()) { - ASYNC_CALL(sendfile, args[4], out_fd, in_fd, in_offset, length) - } else { - SYNC_CALL(sendfile, 0, out_fd, in_fd, in_offset, length) - return scope.Close(Integer::New(SYNC_RESULT)); - } -} - static Handle ReadDir(const Arguments& args) { HandleScope scope; @@ -957,7 +931,6 @@ void File::Initialize(Handle target) { NODE_SET_METHOD(target, "ftruncate", FTruncate); NODE_SET_METHOD(target, "rmdir", RMDir); NODE_SET_METHOD(target, "mkdir", MKDir); - NODE_SET_METHOD(target, "sendfile", SendFile); NODE_SET_METHOD(target, "readdir", ReadDir); NODE_SET_METHOD(target, "stat", Stat); NODE_SET_METHOD(target, "lstat", LStat); diff --git a/test/disabled/test-fs-sendfile.js b/test/disabled/test-fs-sendfile.js deleted file mode 100644 index 44169bda611..00000000000 --- a/test/disabled/test-fs-sendfile.js +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - - - - -var common = require('../common'); -var assert = require('assert'); - -var net = require('net'); -var util = require('util'); -var x = path.join(common.fixturesDir, 'x.txt'); -var expected = 'xyz'; - -var server = net.createServer(function(socket) { - socket.on('receive', function(data) { - found = data; - client.close(); - socket.close(); - server.close(); - assert.equal(expected, found); - }); -}); -server.listen(common.PORT); - -var client = net.createConnection(common.PORT); -client.on('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); - }); - }); -});