Skip to content

File size is different after upload ! #260

@uchar

Description

@uchar

Describe the bug
Just a basic file upload compelte with no error but the file size is different after upload and the file is corrupt.
on server :
image

on local device :
image

Can not open the file after download :
image

Example code

import { Client } from 'basic-ftp';

const main = async (): Promise<void> => {
  const ftpClient = new Client(900000);
  await ftpClient.access({
    host: '....',
    user: '...',
    password: '....',
  });
  ftpClient.trackProgress((info) => {
    console.log('Transferred', info.bytes, info.bytesOverall);
  });
  ftpClient.ftp.verbose = true;
  await ftpClient.uploadFrom('backups/1.zip', '1.zip');
  ftpClient.close();
};

main()
  .then(() => {
    console.log('Completed successfully.');
    process.exit(0);
  })
  .catch((error) => {
    console.error('An error occurred:', error);
    process.exit(1);
  });

Console output
From the log you can see somehow it immediatel jump to 1245184 but the thing is every time I run the code the output size is different

> ts-node src/test.ts

Trying to find optimal transfer strategy...
> EPSV
< 229 Entering Extended Passive Mode (|||35578|)

Optimal transfer strategy found.
> STOR 1.zip
< 150 Opening BINARY mode data connection for 1.zip

Uploading to ip:35578 (No encryption)
Transferred 0 0
Transferred 1245184 1245184
Transferred 1310720 1310720
Transferred 1310720 1310720
Transferred 1310720 1310720
Transferred 1310720 1310720
Transferred 1310720 1310720
Transferred 1310720 1310720
Transferred 1310720 1310720
Transferred 1310720 1310720
Transferred 1310720 1310720
Transferred 1507328 1507328
Transferred 1507328 1507328
Transferred 1507328 1507328
Transferred 1507328 1507328
Transferred 1507328 1507328
Transferred 1507328 1507328
Transferred 1638400 1638400
Transferred 1638400 1638400
Transferred 1638400 1638400
Transferred 1703936 1703936
Transferred 1703936 1703936
Transferred 1769472 1769472
Transferred 1835008 1835008
Transferred 1900544 1900544
Transferred 1900544 1900544
Transferred 1900544 1900544
Transferred 1989694 1989694
Transferred 1989694 1989694
< 226 Transfer complete

> QUIT
Completed successfully.

Which version of Node.js are you using?
Node : v22.11.0

Which version of basic-ftp are you using?
5.0.5

Additional context
Running in windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions