smb2Client.open('test.txt', 'w', function(err, fd) {
if (err) throw err;
smb2Client.write(
fd, // file descriptor
Buffer.from('asdf'), // data to write to the file
0, // offset in the buffer
10, // number of bytes to write
0, // offset in the file
function(err, bytesWritten, buffer) {
smb2Client.close(fd, function() {});
if (err) throw cb(err);
console.log(bytesWritten);
}
);
AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:
assert(offset > 0)
at module.exports.write (C:\Users\USERNAME\Desktop\node\test\image-download-main\node_modules\@marsaud\smb2\lib\api\write.js:13:5)
at module.exports.write (C:\Users\USERNAME\Desktop\node\test\image-download-main\node_modules\@marsaud\smb2\lib\tools\auto-promise.js:30:8)
at C:\Users\USERNAME\Desktop\node\test\image-download-main\demo_samba.js:177:16
at C:\Users\USERNAME\Desktop\node\test\image-download-main\node_modules\@marsaud\smb2\lib\tools\smb2-connection.js:153:8
at Object.04000000 (C:\Users\USERNAME\Desktop\node\test\image-download-main\node_modules\@marsaud\smb2\lib\tools\message.js:15:15)
at Socket.<anonymous> (C:\Users\USERNAME\Desktop\node\test\image-download-main\node_modules\@marsaud\smb2\lib\tools\smb2-forge.js:71:31)
at Socket.emit (events.js:315:20)
at addChunk (internal/streams/readable.js:309:12)
at readableAddChunk (internal/streams/readable.js:284:9)
at Socket.Readable.push (internal/streams/readable.js:223:10) {
generatedMessage: true,
code: 'ERR_ASSERTION',
actual: false,
expected: true,
operator: '=='
}
---------- demo_samba.js
...
smb2Client.open('test.txt', 'w', function(err, fd) { if (err) throw err;
});
` PS C:\Users\USERNAME\Desktop\node\test\image-download-main> node demo_samba.js assert.js:383 throw err; ^
`