chore(fs/smb#_getClient): remove unnecessary param

This commit is contained in:
Julien Fontanet 2018-07-11 10:23:49 +02:00
parent f6e48adc28
commit c2c62b20f0

View File

@ -12,13 +12,13 @@ const normalizeError = error => {
return code === 'STATUS_OBJECT_NAME_NOT_FOUND' ||
code === 'STATUS_OBJECT_PATH_NOT_FOUND'
? Object.create(error, {
code: {
configurable: true,
readable: true,
value: 'ENOENT',
writable: true,
},
})
code: {
configurable: true,
readable: true,
value: 'ENOENT',
writable: true,
},
})
: error
}
@ -32,7 +32,9 @@ export default class SmbHandler extends RemoteHandlerAbstract {
return 'smb'
}
_getClient (remote) {
_getClient () {
const remote = this._remote
return new Smb2({
share: `\\\\${remote.host}`,
domain: remote.domain,
@ -81,7 +83,7 @@ export default class SmbHandler extends RemoteHandlerAbstract {
}
async _outputFile (file, data, options = {}) {
const client = this._getClient(this._remote)
const client = this._getClient()
const path = this._getFilePath(file)
const dir = this._dirname(path)
@ -95,7 +97,7 @@ export default class SmbHandler extends RemoteHandlerAbstract {
}
async _readFile (file, options = {}) {
const client = this._getClient(this._remote)
const client = this._getClient()
let content
try {
@ -112,7 +114,7 @@ export default class SmbHandler extends RemoteHandlerAbstract {
}
async _rename (oldPath, newPath) {
const client = this._getClient(this._remote)
const client = this._getClient()
try {
await client
@ -126,7 +128,7 @@ export default class SmbHandler extends RemoteHandlerAbstract {
}
async _list (dir = '.') {
const client = this._getClient(this._remote)
const client = this._getClient()
let list
try {
@ -144,7 +146,7 @@ export default class SmbHandler extends RemoteHandlerAbstract {
if (typeof file !== 'string') {
file = file.path
}
const client = this._getClient(this._remote)
const client = this._getClient()
let stream
try {
@ -162,7 +164,7 @@ export default class SmbHandler extends RemoteHandlerAbstract {
if (typeof file !== 'string') {
file = file.path
}
const client = this._getClient(this._remote)
const client = this._getClient()
const path = this._getFilePath(file)
const dir = this._dirname(path)
let stream
@ -180,7 +182,7 @@ export default class SmbHandler extends RemoteHandlerAbstract {
}
async _unlink (file) {
const client = this._getClient(this._remote)
const client = this._getClient()
try {
await client.unlink(this._getFilePath(file))::pFinally(() => {
@ -192,7 +194,7 @@ export default class SmbHandler extends RemoteHandlerAbstract {
}
async _getSize (file) {
const client = await this._getClient(this._remote)
const client = await this._getClient()
let size
try {