@rsdk/common.node 4.1.0-next.1 → 4.2.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/misc.d.ts +7 -0
- package/dist/misc.js +14 -1
- package/dist/misc.js.map +1 -1
- package/package.json +2 -2
- package/src/misc.ts +15 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [4.2.0-next.0](https://github.com/R-Vision/rsdk/compare/v4.1.0...v4.2.0-next.0) (2024-02-02)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **s3:** added @rsdk/s3 package ([03bd9ea](https://github.com/R-Vision/rsdk/commit/03bd9ea7e5f78be6c93b1a2547fe7c2639ca0146))
|
|
11
|
+
|
|
12
|
+
## [4.1.0](https://github.com/R-Vision/rsdk/compare/v4.1.0-next.1...v4.1.0) (2024-01-24)
|
|
13
|
+
|
|
14
|
+
**Note:** Version bump only for package @rsdk/common.node
|
|
15
|
+
|
|
6
16
|
## [4.1.0-next.1](https://github.com/R-Vision/rsdk/compare/v4.1.0-next.0...v4.1.0-next.1) (2024-01-24)
|
|
7
17
|
|
|
8
18
|
**Note:** Version bump only for package @rsdk/common.node
|
package/dist/misc.d.ts
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
+
/// <reference types="node" />
|
|
3
4
|
import type { PathLike } from 'node:fs';
|
|
4
5
|
import type { Readable } from 'node:stream';
|
|
5
6
|
/**
|
|
6
7
|
* Writes contents of readable stream to file
|
|
7
8
|
*/
|
|
8
9
|
export declare const streamWriteFile: (stream: Readable, path: PathLike) => Promise<void>;
|
|
10
|
+
/**
|
|
11
|
+
* Reads stream to Node.js Buffer chunk by chunk
|
|
12
|
+
* @param stream Readable stream
|
|
13
|
+
* @returns Promise<Buffer>
|
|
14
|
+
*/
|
|
15
|
+
export declare const streamToBuffer: (stream: Readable) => Promise<Buffer>;
|
package/dist/misc.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.streamWriteFile = void 0;
|
|
3
|
+
exports.streamToBuffer = exports.streamWriteFile = void 0;
|
|
4
4
|
const node_fs_1 = require("node:fs");
|
|
5
5
|
/**
|
|
6
6
|
* Writes contents of readable stream to file
|
|
@@ -13,4 +13,17 @@ const streamWriteFile = (stream, path) => {
|
|
|
13
13
|
});
|
|
14
14
|
};
|
|
15
15
|
exports.streamWriteFile = streamWriteFile;
|
|
16
|
+
/**
|
|
17
|
+
* Reads stream to Node.js Buffer chunk by chunk
|
|
18
|
+
* @param stream Readable stream
|
|
19
|
+
* @returns Promise<Buffer>
|
|
20
|
+
*/
|
|
21
|
+
const streamToBuffer = async (stream) => {
|
|
22
|
+
const chunks = [];
|
|
23
|
+
for await (const chunk of stream) {
|
|
24
|
+
chunks.push(Buffer.from(chunk));
|
|
25
|
+
}
|
|
26
|
+
return Buffer.concat(chunks);
|
|
27
|
+
};
|
|
28
|
+
exports.streamToBuffer = streamToBuffer;
|
|
16
29
|
//# sourceMappingURL=misc.js.map
|
package/dist/misc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"misc.js","sourceRoot":"","sources":["../src/misc.ts"],"names":[],"mappings":";;;AACA,qCAA4C;AAG5C;;GAEG;AACI,MAAM,eAAe,GAAG,CAC7B,MAAgB,EAChB,IAAc,EACC,EAAE;IACjB,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3C,MAAM,CAAC,IAAI,CAAC,IAAA,2BAAiB,EAAC,IAAI,CAAC,CAAC,CAAC;QACrC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC7B,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AATW,QAAA,eAAe,mBAS1B"}
|
|
1
|
+
{"version":3,"file":"misc.js","sourceRoot":"","sources":["../src/misc.ts"],"names":[],"mappings":";;;AACA,qCAA4C;AAG5C;;GAEG;AACI,MAAM,eAAe,GAAG,CAC7B,MAAgB,EAChB,IAAc,EACC,EAAE;IACjB,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3C,MAAM,CAAC,IAAI,CAAC,IAAA,2BAAiB,EAAC,IAAI,CAAC,CAAC,CAAC;QACrC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC7B,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AATW,QAAA,eAAe,mBAS1B;AAEF;;;;GAIG;AACI,MAAM,cAAc,GAAG,KAAK,EAAE,MAAgB,EAAmB,EAAE;IACxE,MAAM,MAAM,GAAG,EAAE,CAAC;IAElB,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QACjC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAClC,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC,CAAC;AARW,QAAA,cAAc,kBAQzB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdk/common.node",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0-next.0",
|
|
4
4
|
"description": "Useful common classes, functions and types",
|
|
5
5
|
"license": "Apache License 2.0",
|
|
6
6
|
"publishConfig": {
|
|
@@ -19,5 +19,5 @@
|
|
|
19
19
|
"toml": "^3.0.0",
|
|
20
20
|
"yaml": "^2.3.1"
|
|
21
21
|
},
|
|
22
|
-
"gitHead": "
|
|
22
|
+
"gitHead": "e4b95e1971841f8492f9df493fa4fe4f13f9bb5f"
|
|
23
23
|
}
|
package/src/misc.ts
CHANGED
|
@@ -15,3 +15,18 @@ export const streamWriteFile = (
|
|
|
15
15
|
stream.once('end', resolve);
|
|
16
16
|
});
|
|
17
17
|
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Reads stream to Node.js Buffer chunk by chunk
|
|
21
|
+
* @param stream Readable stream
|
|
22
|
+
* @returns Promise<Buffer>
|
|
23
|
+
*/
|
|
24
|
+
export const streamToBuffer = async (stream: Readable): Promise<Buffer> => {
|
|
25
|
+
const chunks = [];
|
|
26
|
+
|
|
27
|
+
for await (const chunk of stream) {
|
|
28
|
+
chunks.push(Buffer.from(chunk));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return Buffer.concat(chunks);
|
|
32
|
+
};
|