Verify compatibility with Node 18
-[] fetch is introduced globally in Node 18. Verify the compatibility in 3.0.0 and 4.x-previews
-[] Verify stream upload using LargeFileUploadTask
Ran into a bit of an issue with the putStream method, which I think is related to Node 18. With the following code:
const stream = fs.createReadStream('the path');
await client.api(...).putStream(stream);
Get the following error: Could not upload file to Sharepoint RequestInit: duplex option is required when sending a body.
Seems like this is related to changes in the Fetch spec: https://github.com/nodejs/node/issues/46221
Thankfully, we can pass in the duplex: "half" Fetch option i.e.
await client.api(...)
.options({ duplex: 'half' })
.putStream(stream);
However, this seems a little clunky and is not very obvious or ergonomic. Would suggest automatically applying this option internally (if it's not been set).