@js-ak/excel-toolbox 1.3.0 → 1.3.1

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.
@@ -84,7 +84,71 @@ async function createWithStream(fileKeys, destination, output) {
84
84
  cb(null, chunk);
85
85
  },
86
86
  });
87
- await (0, promises_1.pipeline)(source, sizeCounter, crc32, deflater, collectCompressed, new node_stream_1.PassThrough());
87
+ // deflater.on("data", (chunk) => { console.log("deflater data path:", fullPath, "length:", chunk.length); });
88
+ // deflater.on("finish", () => { console.log("deflater finished path:", fullPath, "uncompSize:", uncompSize, "compSize:", compSize); });
89
+ // deflater.on("error", (err) => { console.log("deflater error path:", fullPath, "error:", err); });
90
+ // deflater.on("close", () => { console.log("deflater closed path:", fullPath); });
91
+ // deflater.on("pipe", (src) => { console.log("deflater pipe path:", fullPath); });
92
+ // deflater.on("unpipe", (src) => { console.log("deflater unpipe path:", fullPath); });
93
+ // deflater.on("drain", () => { console.log("deflater drain path:", fullPath); });
94
+ // deflater.on("pause", () => { console.log("deflater pause path:", fullPath); });
95
+ // deflater.on("resume", () => { console.log("deflater resume path:", fullPath); });
96
+ // deflater.on("end", () => console.log("deflater ended, path:", fullPath));
97
+ // source.on("data", (chunk) => { console.log("source data path:", fullPath, "length:", chunk.length); });
98
+ // source.on("finish", () => { console.log("source finished path:", fullPath, "uncompSize:", uncompSize, "compSize:", compSize); });
99
+ // source.on("error", (err) => { console.log("source error path:", fullPath, "error:", err); });
100
+ // source.on("close", () => { console.log("source closed path:", fullPath); });
101
+ // source.on("pipe", (src) => { console.log("source pipe path:", fullPath); });
102
+ // source.on("unpipe", (src) => { console.log("source unpipe path:", fullPath); });
103
+ // source.on("drain", () => { console.log("source drain path:", fullPath); });
104
+ // source.on("pause", () => { console.log("source pause path:", fullPath); });
105
+ // source.on("resume", () => { console.log("source resume path:", fullPath); });
106
+ // source.on("end", () => console.log("source ended, path:", fullPath));
107
+ // sizeCounter.on("data", (chunk) => { console.log("sizeCounter data path:", fullPath, "length:", chunk.length); });
108
+ // sizeCounter.on("finish", () => { console.log("sizeCounter finished path:", fullPath, "uncompSize:", uncompSize, "compSize:", compSize); });
109
+ // sizeCounter.on("error", (err) => { console.log("sizeCounter error path:", fullPath, "error:", err); });
110
+ // sizeCounter.on("close", () => { console.log("sizeCounter closed path:", fullPath); });
111
+ // sizeCounter.on("pipe", (src) => { console.log("sizeCounter pipe path:", fullPath); });
112
+ // sizeCounter.on("unpipe", (src) => { console.log("sizeCounter unpipe path:", fullPath); });
113
+ // sizeCounter.on("drain", () => { console.log("sizeCounter drain path:", fullPath); });
114
+ // sizeCounter.on("pause", () => { console.log("sizeCounter pause path:", fullPath); });
115
+ // sizeCounter.on("resume", () => { console.log("sizeCounter resume path:", fullPath); });
116
+ // sizeCounter.on("end", () => console.log("sizeCounter ended, path:", fullPath));
117
+ // crc32.on("data", (chunk) => { console.log("crc32 data path:", fullPath, "length:", chunk.length); });
118
+ // crc32.on("finish", () => { console.log("crc32 finished path:", fullPath, "uncompSize:", uncompSize, "compSize:", compSize); });
119
+ // crc32.on("error", (err) => { console.log("crc32 error path:", fullPath, "error:", err); });
120
+ // crc32.on("close", () => { console.log("crc32 closed path:", fullPath); });
121
+ // crc32.on("pipe", (src) => { console.log("crc32 pipe path:", fullPath); });
122
+ // crc32.on("unpipe", (src) => { console.log("crc32 unpipe path:", fullPath); });
123
+ // crc32.on("drain", () => { console.log("crc32 drain path:", fullPath); });
124
+ // crc32.on("pause", () => { console.log("crc32 pause path:", fullPath); });
125
+ // crc32.on("resume", () => { console.log("crc32 resume path:", fullPath); });
126
+ // crc32.on("end", () => console.log("crc32 ended, path:", fullPath));
127
+ collectCompressed.on("data", ( /* chunk */) => { });
128
+ // collectCompressed.on("finish", () => { console.log("collectCompressed finished path:", fullPath, "uncompSize:", uncompSize, "compSize:", compSize); });
129
+ // collectCompressed.on("error", (err) => { console.log("collectCompressed error path:", fullPath, "error:", err); });
130
+ // collectCompressed.on("close", () => { console.log("collectCompressed closed path:", fullPath); });
131
+ // collectCompressed.on("pipe", (src) => { console.log("collectCompressed pipe path:", fullPath); });
132
+ // collectCompressed.on("unpipe", (src) => { console.log("collectCompressed unpipe path:", fullPath); });
133
+ // collectCompressed.on("drain", () => { console.log("collectCompressed drain path:", fullPath); });
134
+ // collectCompressed.on("pause", () => { console.log("collectCompressed pause path:", fullPath); });
135
+ // collectCompressed.on("resume", () => { console.log("collectCompressed resume path:", fullPath); });
136
+ // collectCompressed.on("end", () => console.log("collectCompressed ended, path:", fullPath));
137
+ // deflater.on("readable", () => {
138
+ // console.log("deflater readable path:", fullPath);
139
+ // });
140
+ await (0, promises_1.pipeline)(source, sizeCounter, crc32, deflater, collectCompressed);
141
+ // await new Promise<void>((resolve, reject) => {
142
+ // source
143
+ // .pipe(sizeCounter)
144
+ // .pipe(crc32)
145
+ // .pipe(deflater)
146
+ // .pipe(collectCompressed)
147
+ // .on("finish", resolve)
148
+ // .on("error", reject);
149
+ // source.on("error", reject);
150
+ // deflater.on("error", reject);
151
+ // });
88
152
  const crc = crc32.digest();
89
153
  const compressed = Buffer.concat(compressedChunks);
90
154
  const localHeader = Buffer.concat([
@@ -24,6 +24,12 @@ function crc32(byte, crc = 0xffffffff) {
24
24
  function crc32Stream() {
25
25
  let crc = 0xffffffff;
26
26
  const transform = new node_stream_1.Transform({
27
+ final(callback) {
28
+ callback();
29
+ },
30
+ flush(callback) {
31
+ callback();
32
+ },
27
33
  transform(chunk, _encoding, callback) {
28
34
  for (let i = 0; i < chunk.length; i++) {
29
35
  crc = crc32(chunk[i], crc);
@@ -1,5 +1,5 @@
1
1
  import * as path from "node:path";
2
- import { PassThrough, Transform } from "node:stream";
2
+ import { Transform } from "node:stream";
3
3
  import { createReadStream } from "node:fs";
4
4
  import { pipeline } from "node:stream/promises";
5
5
  import zlib from "node:zlib";
@@ -45,7 +45,71 @@ export async function createWithStream(fileKeys, destination, output) {
45
45
  cb(null, chunk);
46
46
  },
47
47
  });
48
- await pipeline(source, sizeCounter, crc32, deflater, collectCompressed, new PassThrough());
48
+ // deflater.on("data", (chunk) => { console.log("deflater data path:", fullPath, "length:", chunk.length); });
49
+ // deflater.on("finish", () => { console.log("deflater finished path:", fullPath, "uncompSize:", uncompSize, "compSize:", compSize); });
50
+ // deflater.on("error", (err) => { console.log("deflater error path:", fullPath, "error:", err); });
51
+ // deflater.on("close", () => { console.log("deflater closed path:", fullPath); });
52
+ // deflater.on("pipe", (src) => { console.log("deflater pipe path:", fullPath); });
53
+ // deflater.on("unpipe", (src) => { console.log("deflater unpipe path:", fullPath); });
54
+ // deflater.on("drain", () => { console.log("deflater drain path:", fullPath); });
55
+ // deflater.on("pause", () => { console.log("deflater pause path:", fullPath); });
56
+ // deflater.on("resume", () => { console.log("deflater resume path:", fullPath); });
57
+ // deflater.on("end", () => console.log("deflater ended, path:", fullPath));
58
+ // source.on("data", (chunk) => { console.log("source data path:", fullPath, "length:", chunk.length); });
59
+ // source.on("finish", () => { console.log("source finished path:", fullPath, "uncompSize:", uncompSize, "compSize:", compSize); });
60
+ // source.on("error", (err) => { console.log("source error path:", fullPath, "error:", err); });
61
+ // source.on("close", () => { console.log("source closed path:", fullPath); });
62
+ // source.on("pipe", (src) => { console.log("source pipe path:", fullPath); });
63
+ // source.on("unpipe", (src) => { console.log("source unpipe path:", fullPath); });
64
+ // source.on("drain", () => { console.log("source drain path:", fullPath); });
65
+ // source.on("pause", () => { console.log("source pause path:", fullPath); });
66
+ // source.on("resume", () => { console.log("source resume path:", fullPath); });
67
+ // source.on("end", () => console.log("source ended, path:", fullPath));
68
+ // sizeCounter.on("data", (chunk) => { console.log("sizeCounter data path:", fullPath, "length:", chunk.length); });
69
+ // sizeCounter.on("finish", () => { console.log("sizeCounter finished path:", fullPath, "uncompSize:", uncompSize, "compSize:", compSize); });
70
+ // sizeCounter.on("error", (err) => { console.log("sizeCounter error path:", fullPath, "error:", err); });
71
+ // sizeCounter.on("close", () => { console.log("sizeCounter closed path:", fullPath); });
72
+ // sizeCounter.on("pipe", (src) => { console.log("sizeCounter pipe path:", fullPath); });
73
+ // sizeCounter.on("unpipe", (src) => { console.log("sizeCounter unpipe path:", fullPath); });
74
+ // sizeCounter.on("drain", () => { console.log("sizeCounter drain path:", fullPath); });
75
+ // sizeCounter.on("pause", () => { console.log("sizeCounter pause path:", fullPath); });
76
+ // sizeCounter.on("resume", () => { console.log("sizeCounter resume path:", fullPath); });
77
+ // sizeCounter.on("end", () => console.log("sizeCounter ended, path:", fullPath));
78
+ // crc32.on("data", (chunk) => { console.log("crc32 data path:", fullPath, "length:", chunk.length); });
79
+ // crc32.on("finish", () => { console.log("crc32 finished path:", fullPath, "uncompSize:", uncompSize, "compSize:", compSize); });
80
+ // crc32.on("error", (err) => { console.log("crc32 error path:", fullPath, "error:", err); });
81
+ // crc32.on("close", () => { console.log("crc32 closed path:", fullPath); });
82
+ // crc32.on("pipe", (src) => { console.log("crc32 pipe path:", fullPath); });
83
+ // crc32.on("unpipe", (src) => { console.log("crc32 unpipe path:", fullPath); });
84
+ // crc32.on("drain", () => { console.log("crc32 drain path:", fullPath); });
85
+ // crc32.on("pause", () => { console.log("crc32 pause path:", fullPath); });
86
+ // crc32.on("resume", () => { console.log("crc32 resume path:", fullPath); });
87
+ // crc32.on("end", () => console.log("crc32 ended, path:", fullPath));
88
+ collectCompressed.on("data", ( /* chunk */) => { });
89
+ // collectCompressed.on("finish", () => { console.log("collectCompressed finished path:", fullPath, "uncompSize:", uncompSize, "compSize:", compSize); });
90
+ // collectCompressed.on("error", (err) => { console.log("collectCompressed error path:", fullPath, "error:", err); });
91
+ // collectCompressed.on("close", () => { console.log("collectCompressed closed path:", fullPath); });
92
+ // collectCompressed.on("pipe", (src) => { console.log("collectCompressed pipe path:", fullPath); });
93
+ // collectCompressed.on("unpipe", (src) => { console.log("collectCompressed unpipe path:", fullPath); });
94
+ // collectCompressed.on("drain", () => { console.log("collectCompressed drain path:", fullPath); });
95
+ // collectCompressed.on("pause", () => { console.log("collectCompressed pause path:", fullPath); });
96
+ // collectCompressed.on("resume", () => { console.log("collectCompressed resume path:", fullPath); });
97
+ // collectCompressed.on("end", () => console.log("collectCompressed ended, path:", fullPath));
98
+ // deflater.on("readable", () => {
99
+ // console.log("deflater readable path:", fullPath);
100
+ // });
101
+ await pipeline(source, sizeCounter, crc32, deflater, collectCompressed);
102
+ // await new Promise<void>((resolve, reject) => {
103
+ // source
104
+ // .pipe(sizeCounter)
105
+ // .pipe(crc32)
106
+ // .pipe(deflater)
107
+ // .pipe(collectCompressed)
108
+ // .on("finish", resolve)
109
+ // .on("error", reject);
110
+ // source.on("error", reject);
111
+ // deflater.on("error", reject);
112
+ // });
49
113
  const crc = crc32.digest();
50
114
  const compressed = Buffer.concat(compressedChunks);
51
115
  const localHeader = Buffer.concat([
@@ -21,6 +21,12 @@ function crc32(byte, crc = 0xffffffff) {
21
21
  export function crc32Stream() {
22
22
  let crc = 0xffffffff;
23
23
  const transform = new Transform({
24
+ final(callback) {
25
+ callback();
26
+ },
27
+ flush(callback) {
28
+ callback();
29
+ },
24
30
  transform(chunk, _encoding, callback) {
25
31
  for (let i = 0; i < chunk.length; i++) {
26
32
  crc = crc32(chunk[i], crc);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@js-ak/excel-toolbox",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "excel-toolbox",
5
5
  "publishConfig": {
6
6
  "access": "public",