Skip to content

How to read partial data from the remote files using downloadTo API?  #252

Open
@aditya81070

Description

Describe the bug
This is not a bug but rather a question related to working of download API.

I have already checked #58 and understand how can I use passThrough or writeStreams to download the files or simultaneously. I couldn't find any example for reading partial data from a file.

Example code
A short and standalone code example that demonstrates the issue. Don't copy-paste a few lines from your project, it makes it difficult to rule out issues in other parts of your code.

  const client = new Client();
  await client.access();
  const files = await client.list('/out');
  const readStream = new Stream.PassThrough();
  await client.downloadTo(transform, `/out/${selectedFile.name}`);
 // how to stop the above operation so it doesn't read complete file. 

Console output
Use client.ftp.verbose = true to log every communication detail. Copy-paste the output of your console here. Make sure to redact IPs, URLs or passwords.

Which version of Node.js are you using?
v21.2.0

Which version of basic-ftp are you using?
^5.0.5

Additional context
Add any other context about the problem here. What FTP server are you using? What environment are you running in?

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