Skip to content

Commit

Permalink
Merge pull request #208 from PermanentOrg/207-support-non-sequential-…
Browse files Browse the repository at this point in the history
…write

Support non-sequential writes
  • Loading branch information
slifty authored Aug 15, 2023
2 parents 4c5965e + 860daf7 commit d1a327d
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/classes/SftpSessionHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,30 @@ export class SftpSessionHandler {
);
return;
}

if (offset + data.length > 5368709120) { // 5 GB
logger.verbose(
'Response: Status (FAILURE)',
{
reqId,
code: SFTP_STATUS_CODE.FAILURE,
path: temporaryFile.virtualPath,
},
);
this.sftpConnection.status(
reqId,
SFTP_STATUS_CODE.FAILURE,
'You cannot upload files larger then 5 GB.',
);
return;
}

fs.write(
temporaryFile.fd,
data,
0,
data.length,
offset,
(err, written, buffer) => {
if (err) {
logger.verbose(
Expand Down

0 comments on commit d1a327d

Please sign in to comment.