Skip to content

uploadFromStream crashes with createReadStream #42

@maximelafarie

Description

@maximelafarie

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions