Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function fromStream(stream) {
const readableWebToNodeStream = new ReadableWebToNodeStream(stream);
const fileType = await core.fromStream(readableWebToNodeStream);
await readableWebToNodeStream.close();
return fileType;
}
export async function parseReadableStream(stream: ReadableStream, contentType, options?: IOptions): Promise {
const ns = new ReadableWebToNodeStream(stream);
const res = await parseNodeStream(ns, contentType, options);
debug(`Completed parsing from stream bytesRead=${ns.bytesRead} / fileSize=${options && options.fileSize ? options.fileSize : '?'}`);
await ns.close();
return res;
}