Compare commits

...

4 Commits

Author SHA1 Message Date
fa93f13306 2.0.19 2023-11-03 00:47:43 +01:00
81694cf58c fix(core): update 2023-11-03 00:47:42 +01:00
fdd1c7cdb3 2.0.18 2023-07-12 00:53:10 +02:00
40f330791f fix(core): update 2023-07-12 00:53:09 +02:00
6 changed files with 731 additions and 498 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "@pushrocks/smartrequest",
"version": "2.0.17",
"version": "2.0.19",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@pushrocks/smartrequest",
"version": "2.0.17",
"version": "2.0.19",
"license": "MIT",
"dependencies": {
"@pushrocks/smartpromise": "^3.1.7",

View File

@ -1,6 +1,6 @@
{
"name": "@push.rocks/smartrequest",
"version": "2.0.17",
"version": "2.0.19",
"private": false,
"description": "dropin replacement for request",
"main": "dist_ts/index.js",

1203
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@push.rocks/smartrequest',
version: '2.0.17',
version: '2.0.19',
description: 'dropin replacement for request'
}

View File

@ -5,3 +5,4 @@ export type { ISmartRequestOptions } from './smartrequest.interfaces.js';
export * from './smartrequest.jsonrest.js';
export * from './smartrequest.binaryrest.js';
export * from './smartrequest.formdata.js';
export * from './smartrequest.stream.js';

17
ts/smartrequest.stream.ts Normal file
View 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.
}
};