Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
fa93f13306 | |||
81694cf58c | |||
fdd1c7cdb3 | |||
40f330791f | |||
16b4d168db | |||
cc017a9bbf | |||
2adf7e9ee2 | |||
2303b6da7e | |||
4487579bfd |
@ -10,10 +10,10 @@
|
|||||||
"projectType": "npm",
|
"projectType": "npm",
|
||||||
"module": {
|
"module": {
|
||||||
"githost": "gitlab.com",
|
"githost": "gitlab.com",
|
||||||
"gitscope": "pushrocks",
|
"gitscope": "push.rocks",
|
||||||
"gitrepo": "smartrequest",
|
"gitrepo": "smartrequest",
|
||||||
"description": "dropin replacement for request",
|
"description": "dropin replacement for request",
|
||||||
"npmPackagename": "@pushrocks/smartrequest",
|
"npmPackagename": "@push.rocks/smartrequest",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartrequest",
|
"name": "@pushrocks/smartrequest",
|
||||||
"version": "2.0.15",
|
"version": "2.0.19",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@pushrocks/smartrequest",
|
"name": "@pushrocks/smartrequest",
|
||||||
"version": "2.0.15",
|
"version": "2.0.19",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/smartpromise": "^3.1.7",
|
"@pushrocks/smartpromise": "^3.1.7",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartrequest",
|
"name": "@push.rocks/smartrequest",
|
||||||
"version": "2.0.15",
|
"version": "2.0.19",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "dropin replacement for request",
|
"description": "dropin replacement for request",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
@ -25,8 +25,8 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://gitlab.com/pushrocks/smartrequest#README",
|
"homepage": "https://gitlab.com/pushrocks/smartrequest#README",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/smartpromise": "^4.0.2",
|
"@push.rocks/smartpromise": "^4.0.2",
|
||||||
"@pushrocks/smarturl": "^3.0.6",
|
"@push.rocks/smarturl": "^3.0.6",
|
||||||
"agentkeepalive": "^4.3.0",
|
"agentkeepalive": "^4.3.0",
|
||||||
"form-data": "^4.0.0"
|
"form-data": "^4.0.0"
|
||||||
},
|
},
|
||||||
|
1215
pnpm-lock.yaml
generated
1215
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
|||||||
* autocreated commitinfo by @pushrocks/commitinfo
|
* autocreated commitinfo by @pushrocks/commitinfo
|
||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@pushrocks/smartrequest',
|
name: '@push.rocks/smartrequest',
|
||||||
version: '2.0.15',
|
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';
|
||||||
|
@ -7,8 +7,8 @@ import * as path from 'path';
|
|||||||
export { http, https, fs, path };
|
export { http, https, fs, path };
|
||||||
|
|
||||||
// pushrocks scope
|
// pushrocks scope
|
||||||
import * as smartpromise from '@pushrocks/smartpromise';
|
import * as smartpromise from '@push.rocks/smartpromise';
|
||||||
import * as smarturl from '@pushrocks/smarturl';
|
import * as smarturl from '@push.rocks/smarturl';
|
||||||
|
|
||||||
export { smartpromise, smarturl };
|
export { smartpromise, smarturl };
|
||||||
|
|
||||||
|
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.
|
||||||
|
}
|
||||||
|
};
|
Reference in New Issue
Block a user