I am able to fetch a binary body from an API to write it to a file in node.
const fileStream = fs.createWriteStream(filePath);
fetch(apiURL).then((downloadResponse) => {
downloadResponse.body.pipe(fileStream);
});
However, when doing so I get a linting error of:
Property 'pipe' does not exist on type 'ReadableStream'
It seems weird to me that the call would work when the linter gives an error. I even initially thought my logic was wrong and wasted time debugging this working call...
Is my typescript version misidentifying the type for some reason or should I not be able to perform this call ?
I am barely beginning with typescript but on occasion I run into such idiosyncrasies that slow me down when I am doing something that would seem perfectly valid.