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

uploadFromStream crashes with createReadStream #42

Open
maximelafarie opened this issue Sep 28, 2021 · 1 comment
Open

uploadFromStream crashes with createReadStream #42

maximelafarie opened this issue Sep 28, 2021 · 1 comment

Comments

@maximelafarie
Copy link

maximelafarie commented Sep 28, 2021

In my node project I'm doing the following:

const rs = fs.createReadStream(path.join(config.uploadPathTemp, folderName));

// Create folder recursively
await connector.createRecursiveFolder(path.join(user.target));

// Add files to this folder
await connector.uploadFromStream(path.join(user.target), rs);

The stream is good, the folder exists locally and it waits for being uploaded to NC through nextcloud-link uploadFromStream function. But it throws the following error:

Error:
    at i (/Users/maxime/workspace/my-project/node_modules/nextcloud-link/compiled/client.js:83:35691)
    at ReadStream.t (/Users/maxime/workspace/my-project/node_modules/nextcloud-link/compiled/client.js:83:39772)
    at ReadStream.emit (node:events:394:28)
    at ReadStream.emit (node:domain:470:12)
    at emitErrorNT (node:internal/streams/destroy:193:8)
    at emitErrorCloseNT (node:internal/streams/destroy:158:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  message: [Error: EISDIR: illegal operation on a directory, read] {
    errno: -21,
    code: 'EISDIR',
    syscall: 'read'
  }
}

Am I doing something wrong (do I need to pass some flags to createReadStream?) or is there any stuff related to NC or the lib?

@TibixDev
Copy link

You might be trying to read from a directory instead of a file, and you might lack read permissions too. Make sure you are reading a file not a directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants