@bgord/bun 0.18.7 → 0.18.8
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/dist/{file-draft.d.ts → file-draft.service.d.ts} +1 -1
- package/dist/file-draft.service.d.ts.map +1 -0
- package/dist/{file-draft.js → file-draft.service.js} +1 -1
- package/dist/file-draft.service.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/zip-draft.service.d.ts +10 -0
- package/dist/zip-draft.service.d.ts.map +1 -0
- package/dist/zip-draft.service.js +24 -0
- package/dist/zip-draft.service.js.map +1 -0
- package/package.json +4 -2
- package/readme.md +3 -2
- package/src/index.ts +2 -1
- package/src/zip-draft.service.ts +30 -0
- package/dist/file-draft.d.ts.map +0 -1
- package/dist/file-draft.js.map +0 -1
- /package/src/{file-draft.ts → file-draft.service.ts} +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FileDraft } from "./file-draft.service";
|
|
2
|
+
export declare class ZipDraft extends FileDraft {
|
|
3
|
+
private readonly parts;
|
|
4
|
+
constructor(config: {
|
|
5
|
+
filename: string;
|
|
6
|
+
parts: FileDraft[];
|
|
7
|
+
});
|
|
8
|
+
create(): Promise<Buffer>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=zip-draft.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zip-draft.service.d.ts","sourceRoot":"","sources":["../src/zip-draft.service.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,qBAAa,QAAS,SAAQ,SAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAc;gBAExB,MAAM,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,SAAS,EAAE,CAAA;KAAE;IAKtD,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC;CAgBhC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as tools from "@bgord/tools";
|
|
2
|
+
import { ZipFile } from "yazl";
|
|
3
|
+
import { FileDraft } from "./file-draft.service";
|
|
4
|
+
export class ZipDraft extends FileDraft {
|
|
5
|
+
parts;
|
|
6
|
+
constructor(config) {
|
|
7
|
+
super({ filename: config.filename, mime: new tools.Mime("application/zip") });
|
|
8
|
+
this.parts = config.parts;
|
|
9
|
+
}
|
|
10
|
+
async create() {
|
|
11
|
+
const zip = new ZipFile();
|
|
12
|
+
const chunks = [];
|
|
13
|
+
for (const part of this.parts) {
|
|
14
|
+
zip.addReadStream((await part.create()), part.config.filename);
|
|
15
|
+
}
|
|
16
|
+
zip.end();
|
|
17
|
+
zip.outputStream.on("data", (buffer) => chunks.push(buffer));
|
|
18
|
+
return new Promise((resolve, reject) => {
|
|
19
|
+
zip.outputStream.on("end", () => resolve(Buffer.concat(chunks)));
|
|
20
|
+
zip.outputStream.on("error", reject);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=zip-draft.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zip-draft.service.js","sourceRoot":"","sources":["../src/zip-draft.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,MAAM,OAAO,QAAS,SAAQ,SAAS;IACpB,KAAK,CAAc;IAEpC,YAAY,MAAgD;QAC1D,KAAK,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC;QAC9E,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,MAAM;QACV,MAAM,GAAG,GAAG,IAAI,OAAO,EAAE,CAAC;QAC1B,MAAM,MAAM,GAAa,EAAE,CAAC;QAE5B,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAC9B,GAAG,CAAC,aAAa,CAAC,CAAC,MAAM,IAAI,CAAC,MAAM,EAAE,CAAa,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC7E,CAAC;QACD,GAAG,CAAC,GAAG,EAAE,CAAC;QAEV,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,MAAc,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QAErE,OAAO,IAAI,OAAO,CAAS,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC7C,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YACjE,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bgord/bun",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Bartosz Gordon",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"@types/lodash": "4.17.20",
|
|
28
28
|
"@types/mime-types": "3.0.1",
|
|
29
29
|
"@types/nodemailer": "6.4.17",
|
|
30
|
+
"@types/yazl": "^3.3.0",
|
|
30
31
|
"cspell": "9.2.0",
|
|
31
32
|
"knip": "5.62.0",
|
|
32
33
|
"lefthook": "1.12.2",
|
|
@@ -49,6 +50,7 @@
|
|
|
49
50
|
"nodemailer": "7.0.5",
|
|
50
51
|
"sharp": "0.34.3",
|
|
51
52
|
"ssl-checker": "2.0.10",
|
|
52
|
-
"winston": "3.17.0"
|
|
53
|
+
"winston": "3.17.0",
|
|
54
|
+
"yazl": "^3.3.1"
|
|
53
55
|
}
|
|
54
56
|
}
|
package/readme.md
CHANGED
|
@@ -49,7 +49,7 @@ src/
|
|
|
49
49
|
├── event-store.ts
|
|
50
50
|
├── event-stream.vo.ts
|
|
51
51
|
├── event.types.ts
|
|
52
|
-
├── file-draft.ts
|
|
52
|
+
├── file-draft.service.ts
|
|
53
53
|
├── file-location.service.ts
|
|
54
54
|
├── file-uploader.middleware.ts
|
|
55
55
|
├── graceful-shutdown.service.ts
|
|
@@ -103,6 +103,7 @@ src/
|
|
|
103
103
|
├── uptime.service.ts
|
|
104
104
|
├── url-wo-trailing-slash.vo.ts
|
|
105
105
|
├── uuid.vo.ts
|
|
106
|
-
|
|
106
|
+
├── weak-etag-extractor.middleware.ts
|
|
107
|
+
└── zip-draft.service.ts
|
|
107
108
|
```
|
|
108
109
|
|
package/src/index.ts
CHANGED
|
@@ -23,7 +23,7 @@ export * from "./event-handler.service";
|
|
|
23
23
|
export * from "./event-logger.service";
|
|
24
24
|
export * from "./event-store";
|
|
25
25
|
export * from "./event-stream.vo";
|
|
26
|
-
export * from "./file-draft";
|
|
26
|
+
export * from "./file-draft.service";
|
|
27
27
|
export * from "./file-location.service";
|
|
28
28
|
export * from "./file-uploader.middleware";
|
|
29
29
|
export * from "./graceful-shutdown.service";
|
|
@@ -60,3 +60,4 @@ export * from "./uptime.service";
|
|
|
60
60
|
export * from "./url-wo-trailing-slash.vo";
|
|
61
61
|
export * from "./uuid.vo";
|
|
62
62
|
export * from "./weak-etag-extractor.middleware";
|
|
63
|
+
export * from "./zip-draft.service";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Readable } from "node:stream";
|
|
2
|
+
import * as tools from "@bgord/tools";
|
|
3
|
+
import { ZipFile } from "yazl";
|
|
4
|
+
import { FileDraft } from "./file-draft.service";
|
|
5
|
+
|
|
6
|
+
export class ZipDraft extends FileDraft {
|
|
7
|
+
private readonly parts: FileDraft[];
|
|
8
|
+
|
|
9
|
+
constructor(config: { filename: string; parts: FileDraft[] }) {
|
|
10
|
+
super({ filename: config.filename, mime: new tools.Mime("application/zip") });
|
|
11
|
+
this.parts = config.parts;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async create(): Promise<Buffer> {
|
|
15
|
+
const zip = new ZipFile();
|
|
16
|
+
const chunks: Buffer[] = [];
|
|
17
|
+
|
|
18
|
+
for (const part of this.parts) {
|
|
19
|
+
zip.addReadStream((await part.create()) as Readable, part.config.filename);
|
|
20
|
+
}
|
|
21
|
+
zip.end();
|
|
22
|
+
|
|
23
|
+
zip.outputStream.on("data", (buffer: Buffer) => chunks.push(buffer));
|
|
24
|
+
|
|
25
|
+
return new Promise<Buffer>((resolve, reject) => {
|
|
26
|
+
zip.outputStream.on("end", () => resolve(Buffer.concat(chunks)));
|
|
27
|
+
zip.outputStream.on("error", reject);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
package/dist/file-draft.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-draft.d.ts","sourceRoot":"","sources":["../src/file-draft.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAE3C,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC,cAAc,GAAG,cAAc,CAAC;AAE1E,8BAAsB,SAAS;IACjB,QAAQ,CAAC,MAAM,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAA;KAAE;gBAA9C,MAAM,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAA;KAAE;IAEnE,UAAU,IAAI,OAAO;IAOrB,QAAQ,CAAC,MAAM,IAAI,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;IAE3C,UAAU,IAAI,OAAO,CAAC,QAAQ,CAAC;CAKtC"}
|
package/dist/file-draft.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-draft.js","sourceRoot":"","sources":["../src/file-draft.ts"],"names":[],"mappings":"AAKA,MAAM,OAAgB,SAAS;IACR;IAArB,YAAqB,MAA8C;QAA9C,WAAM,GAAN,MAAM,CAAwC;IAAG,CAAC;IAEvE,UAAU;QACR,OAAO,IAAI,OAAO,CAAC;YACjB,cAAc,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG;YACpC,qBAAqB,EAAE,yBAAyB,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG;SACxE,CAAC,CAAC;IACL,CAAC;IAID,KAAK,CAAC,UAAU;QACd,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC;QAEjC,OAAO,IAAI,QAAQ,CAAC,IAAgB,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IACxE,CAAC;CACF"}
|
|
File without changes
|