fix(core): update
This commit is contained in:
parent
fdd1c7cdb3
commit
81694cf58c
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@push.rocks/smartrequest',
|
name: '@push.rocks/smartrequest',
|
||||||
version: '2.0.18',
|
version: '2.0.19',
|
||||||
description: 'dropin replacement for request'
|
description: 'dropin replacement for request'
|
||||||
}
|
}
|
||||||
|
@ -5,3 +5,4 @@ export type { ISmartRequestOptions } from './smartrequest.interfaces.js';
|
|||||||
export * from './smartrequest.jsonrest.js';
|
export * from './smartrequest.jsonrest.js';
|
||||||
export * from './smartrequest.binaryrest.js';
|
export * from './smartrequest.binaryrest.js';
|
||||||
export * from './smartrequest.formdata.js';
|
export * from './smartrequest.formdata.js';
|
||||||
|
export * from './smartrequest.stream.js';
|
||||||
|
17
ts/smartrequest.stream.ts
Normal file
17
ts/smartrequest.stream.ts
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import * as plugins from './smartrequest.plugins.js';
|
||||||
|
import * as interfaces from './smartrequest.interfaces.js';
|
||||||
|
import { request } from './smartrequest.request.js';
|
||||||
|
|
||||||
|
export const getStream = async (
|
||||||
|
urlArg: string,
|
||||||
|
optionsArg: interfaces.ISmartRequestOptions = {}
|
||||||
|
): Promise<plugins.http.IncomingMessage> => {
|
||||||
|
try {
|
||||||
|
// Call the existing request function with responseStreamArg set to true.
|
||||||
|
const responseStream = await request(urlArg, optionsArg, true);
|
||||||
|
return responseStream;
|
||||||
|
} catch (err) {
|
||||||
|
console.error('An error occurred while getting the stream:', err);
|
||||||
|
throw err; // Rethrow the error to be handled by the caller.
|
||||||
|
}
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user