forked from bchelli/node-smb2
-
Notifications
You must be signed in to change notification settings - Fork 53
Open
Description
Hi,
I have an error when i'm reading list of file using readstream.
I have a loop on all file of a dir.
For each file I create a read stream that I pipe to a csv parser streamwritter (https://www.npmjs.com/package/csv-parser).
File is read well but when at the end of loop an error STATUS_FILE_CLOSED occures :
[...]
for (let file of files) {
try {
if(file.isDirectory())
{
continue;
}
var rs = await smb2Client.createReadStream('dummy\\path\\test\\' + file.name,);
rows.push(...await manageCsvFile(rs));
} catch (e) {
console.log('error on file' + file.name, e)
}
}
[...]
--------
async function manageCsvFile(rs) {
let rows = [];
var fd = rs.pipe(csv({
separator: ';'
}));
var end = new Promise(function(resolve, reject) {
fd.on('data', (row) => {
rows.push(row);
})
fd.on('end', () => {
console.log('CSV file successfully processed');
})
fd.on('close', () => {
console.log('Stream has been destroyed and file has been closed');
resolve();
});
});
await end;
return rows;
}----ERROR Message
"errorType": "Error",
"errorMessage": "STATUS_FILE_CLOSED (0xC0000128) : An I/O request other than close and several other special case operations was attempted using a file object that had already been closed.",
"trace": [
"Error: STATUS_FILE_CLOSED (0xC0000128) : An I/O request other than close and several other special case operations was attempted using a file object that had already been closed.",
" at SMB2Forge.request (/var/task/node_modules/@marsaud/smb2/lib/tools/smb2-forge.js:22:15)",
" at Readable.stream._destroy (/var/task/node_modules/@marsaud/smb2/lib/api/createReadStream.js:42:9)",
" at Readable.destroy (internal/streams/destroy.js:39:8)",
" at endReadableNT (internal/streams/readable.js:1350:16)",
" at processTicksAndRejections (internal/process/task_queues.js:82:21)"
]
Can you help me on this issue ?
Best regards
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels