Commit 80b74f0a authored by Julien Fontanet's avatar Julien Fontanet

chore: format with Prettier

parent 7f5124b0
...@@ -16,7 +16,7 @@ module.exports = function createReadStream(path, options, cb) { ...@@ -16,7 +16,7 @@ module.exports = function createReadStream(path, options, cb) {
var fd = options.fd; var fd = options.fd;
var isFd = fd != null; var isFd = fd != null;
var shouldClose = !isFd || (options.autoClose == null || options.autoClose); var shouldClose = !isFd || options.autoClose == null || options.autoClose;
function onOpen(err, file) { function onOpen(err, file) {
if (err != null) { if (err != null) {
......
...@@ -15,7 +15,7 @@ module.exports = function createWriteStream(path, options, cb) { ...@@ -15,7 +15,7 @@ module.exports = function createWriteStream(path, options, cb) {
var fd = options.fd; var fd = options.fd;
var isFd = fd != null; var isFd = fd != null;
var shouldClose = !isFd || (options.autoClose == null || options.autoClose); var shouldClose = !isFd || options.autoClose == null || options.autoClose;
function onCreate(err, file) { function onCreate(err, file) {
if (err != null) { if (err != null) {
......
...@@ -31,7 +31,11 @@ module.exports = function rename(oldPath, newPath, options, cb) { ...@@ -31,7 +31,11 @@ module.exports = function rename(oldPath, newPath, options, cb) {
if (err) if (err)
SMB2Request( SMB2Request(
'create', 'create',
{ path: oldPath, createDisposition: constants.FILE_OPEN, shareAccess: constants.FILE_SHARE_DELETE }, {
path: oldPath,
createDisposition: constants.FILE_OPEN,
shareAccess: constants.FILE_SHARE_DELETE,
},
connection, connection,
function(err, file) { function(err, file) {
if (err) cb && cb(err); if (err) cb && cb(err);
......
...@@ -19,7 +19,11 @@ module.exports = function unlink(path, cb) { ...@@ -19,7 +19,11 @@ module.exports = function unlink(path, cb) {
var connection = this; var connection = this;
// SMB2 open file // SMB2 open file
SMB2Request('create', { path: path, shareAccess: constants.FILE_SHARE_DELETE }, connection, function(err, file) { SMB2Request(
'create',
{ path: path, shareAccess: constants.FILE_SHARE_DELETE },
connection,
function(err, file) {
if (err) cb && cb(err); if (err) cb && cb(err);
// SMB2 query directory // SMB2 query directory
else else
...@@ -38,5 +42,6 @@ module.exports = function unlink(path, cb) { ...@@ -38,5 +42,6 @@ module.exports = function unlink(path, cb) {
}); });
} }
); );
}); }
);
}; };
...@@ -28,9 +28,7 @@ SMB2Connection.requireConnect = function(method) { ...@@ -28,9 +28,7 @@ SMB2Connection.requireConnect = function(method) {
return function() { return function() {
var connection = this; var connection = this;
var args = Array.prototype.slice.call(arguments); var args = Array.prototype.slice.call(arguments);
connect( connect(connection, function(err) {
connection,
function(err) {
// process the cb // process the cb
var cb = args.pop(); var cb = args.pop();
if (typeof cb !== 'function') { if (typeof cb !== 'function') {
...@@ -50,8 +48,7 @@ SMB2Connection.requireConnect = function(method) { ...@@ -50,8 +48,7 @@ SMB2Connection.requireConnect = function(method) {
// manage the connection error // manage the connection error
if (err) cb(err); if (err) cb(err);
else method.apply(connection, args); else method.apply(connection, args);
} });
);
}; };
}; };
...@@ -97,10 +94,7 @@ function connect(connection, cb) { ...@@ -97,10 +94,7 @@ function connect(connection, cb) {
connection.SessionId = Math.floor(Math.random() * 256) & 0xff; connection.SessionId = Math.floor(Math.random() * 256) & 0xff;
// open TCP socket // open TCP socket
connection.socket.connect( connection.socket.connect(connection.port, connection.ip);
connection.port,
connection.ip
);
// SMB2 negotiate connection // SMB2 negotiate connection
SMB2Request('negotiate', {}, connection, function(err) { SMB2Request('negotiate', {}, connection, function(err) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment