Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConcurrentClient uploads twice #41

Closed
andreapinti opened this issue Mar 3, 2020 · 3 comments
Closed

ConcurrentClient uploads twice #41

andreapinti opened this issue Mar 3, 2020 · 3 comments
Assignees
Labels
bug Something isn't working
Projects

Comments

@andreapinti
Copy link

When using upload method with ConcurrentClient, it is uploaded twice and the result file is 2x bigger than the local one.

No matters if you use 1 or 3 parallel clients.

Sample test

const qusly = require('qusly-core');
async function test(){
    var client = new qusly.ConcurrentClient(1);

    await client.connect({
        host: "localhost",
        user: "me",
        // ...
        protocol: "ftp"
    });

    const localPath = "myLocalFile.txt";
    const remotePath = "myRemoteFile.txt";
    client.on("progress", (e,info) => {
        console.log("Percent:",e.percent);
    })
    await client.upload(
        localPath,
        remotePath
    )
    await client.disconnect();

}
test().then(r => console.log(r))

qusly-core version: 2.5.1

@xnerhu xnerhu added the bug Something isn't working label Mar 3, 2020
@xnerhu
Copy link
Member

xnerhu commented Mar 3, 2020

I could reproduce this bug using binary mode, which is used to transfer files like videos or music.
It seems that both ftp and sftp are affected. This is another case where #40 would be very useful at detecting such bugs.

@xnerhu xnerhu added this to To do in Roadmap via automation Mar 3, 2020
@xnerhu xnerhu self-assigned this Mar 3, 2020
@xnerhu xnerhu closed this as completed in a01a147 Mar 4, 2020
Roadmap automation moved this from To do to Done Mar 4, 2020
@xnerhu
Copy link
Member

xnerhu commented Mar 4, 2020

I've fixed it. Everything was fine with the lowest part, which is deciding what dependency needs to be used for a given protocol to transfer a file. See TransferManager. The problem was with encoding option set to utf8 in createReadStream and createWriteStream . See ConcurrentClient.

@xnerhu
Copy link
Member

xnerhu commented Mar 4, 2020

Released in v2.5.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Roadmap
  
Done
Development

No branches or pull requests

2 participants