Node-SMB / marsaud-smb2

SMB2 Client
53 stars 46 forks source link

npm released version 0.13 does not support overwriting existing files with stream #40

Closed gruijter closed 5 years ago

gruijter commented 5 years ago

Error when trying to do smb2Client.createWriteStream on an already existing file. According to the documentation it should just overwrite without error.

{ Error: STATUS_OBJECT_NAME_COLLISION (0xC0000035) : The object name already exists.
    at SMB2Forge.request (/node_modules/@marsaud/smb2/lib/tools/smb2-forge.js:22:15)
    at module.exports.createWriteStream (/node_modules/@marsaud/smb2/lib/api/createWriteStream.js:77:5)
    at /node_modules/@marsaud/smb2/lib/tools/smb2-connection.js:52:21
    at /node_modules/@marsaud/smb2/lib/tools/smb2-connection.js:147:8
    at /node_modules/@marsaud/smb2/lib/tools/smb2-connection.js:116:25
    at Object.<anonymous> (/node_modules/@marsaud/smb2/lib/tools/message.js:15:15)
    at Socket.<anonymous> (/node_modules/@marsaud/smb2/lib/tools/smb2-forge.js:71:31)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
  messageName: 'create',
julien-f commented 5 years ago

Just pass a flags: 'w' in the option, it will allow you to overwrite the file.

gruijter commented 5 years ago

Ok, thx. Will try that. Is that documented somewhere?

gruijter commented 5 years ago

Never mind. Just found the link with flag documentation :)