wrapt-cli 0.1.1 → 0.1.4
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/README.md +17 -0
- package/dist/analyze.js +9 -4
- package/dist/cli.js +135 -27
- package/dist/format.js +2 -1
- package/dist/open.js +31 -0
- package/dist/publish.js +11 -3
- package/dist/render/index.js +2 -1
- package/dist/share/airdrop.js +59 -0
- package/dist/share/page.js +19 -12
- package/dist/share/server.js +32 -1
- package/dist/share/zip.js +68 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,6 +24,23 @@ Put your own first name in place of Ada. When it's done, a QR code appears in yo
|
|
|
24
24
|
Scan it with your phone on the same Wi-Fi to open your cards, save them and copy a ready-made
|
|
25
25
|
caption for each platform.
|
|
26
26
|
|
|
27
|
+
Your cards are saved in a `wrapt-<year>` folder inside the folder you ran the command from,
|
|
28
|
+
with a ZIP of each set. Your private stats stay separately in `~/.wrapt/<year>/`. To open the
|
|
29
|
+
cards folder:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npx wrapt-cli open
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**On a Mac with an iPhone?** Skip the QR code and AirDrop the cards straight into Photos:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npx wrapt-cli airdrop
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Pick your iPhone in the AirDrop window and tap **Accept** on the phone. Add `--set carousel` for
|
|
42
|
+
the carousel cards, or `--set all` for every card.
|
|
43
|
+
|
|
27
44
|
Step-by-step guide: **https://wrapt.cc**
|
|
28
45
|
|
|
29
46
|
## What you get
|
package/dist/analyze.js
CHANGED
|
@@ -27,9 +27,14 @@ export async function analyze(opts) {
|
|
|
27
27
|
const outDir = opts.outDir ?? path.join(wraptHome(), String(opts.year));
|
|
28
28
|
fs.mkdirSync(outDir, { recursive: true, mode: 0o700 });
|
|
29
29
|
const statsPath = path.join(outDir, "stats.json");
|
|
30
|
-
const samplesPath = path.join(outDir, "samples.json");
|
|
31
30
|
fs.writeFileSync(statsPath, JSON.stringify(stats, null, 2) + "\n", { mode: 0o600 });
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
const samplesPath = path.join(outDir, "samples.json");
|
|
32
|
+
if (opts.samples) {
|
|
33
|
+
// samples.json holds prompt excerpts: private, local only, never rendered. Only the /wrapt skill needs it.
|
|
34
|
+
fs.writeFileSync(samplesPath, JSON.stringify({ year: opts.year, samples }, null, 2) + "\n", { mode: 0o600 });
|
|
35
|
+
return { stats, samples, statsPath, samplesPath };
|
|
36
|
+
}
|
|
37
|
+
// Don't leave excerpts from an earlier --samples run lying around.
|
|
38
|
+
fs.rmSync(samplesPath, { force: true });
|
|
39
|
+
return { stats, samples, statsPath };
|
|
35
40
|
}
|
package/dist/cli.js
CHANGED
|
@@ -6,29 +6,41 @@ import { analyze, wraptHome } from "./analyze.js";
|
|
|
6
6
|
import { NarrativeSchema, narrativeJsonSchema } from "./narrative.js";
|
|
7
7
|
import { renderAll } from "./render/index.js";
|
|
8
8
|
import { SITE_URL } from "./site.js";
|
|
9
|
-
import { startShare } from "./share/server.js";
|
|
9
|
+
import { cardZips, collectAssets, startShare } from "./share/server.js";
|
|
10
|
+
import { openFolder, tildify } from "./open.js";
|
|
11
|
+
import { airdrop } from "./share/airdrop.js";
|
|
10
12
|
import qrcode from "qrcode-terminal";
|
|
11
13
|
import readlinePromises from "node:readline/promises";
|
|
12
14
|
import { buildSite, pushSite, resolveTarget } from "./publish.js";
|
|
13
15
|
import { THEMES } from "./render/theme.js";
|
|
14
16
|
import { StatsSchema } from "./stats/schema.js";
|
|
15
17
|
import { summary } from "./format.js";
|
|
18
|
+
/** A path as the user would type it: ./wrapt-2026 under the current folder, ~/… under home. */
|
|
19
|
+
function shown(p) {
|
|
20
|
+
const rel = path.relative(process.cwd(), p);
|
|
21
|
+
return rel && !rel.startsWith("..") && !path.isAbsolute(rel) ? `./${rel}` : tildify(p);
|
|
22
|
+
}
|
|
16
23
|
const HELP = `wrapt — your year with Claude Code, wrapped. 100% local.
|
|
17
24
|
|
|
18
25
|
Run it with npx: npx wrapt-cli <command> (or install it: npm i -g wrapt-cli, then wrapt <command>)
|
|
19
26
|
|
|
20
27
|
Usage
|
|
21
|
-
wrapt analyze [--year 2026] [--source all|claude|copilot] [--json] [--
|
|
28
|
+
wrapt analyze [--year 2026] [--source all|claude|copilot] [--json] [--samples] [--projects-dir <dir>]
|
|
22
29
|
wrapt render [--year 2026] [--name "Ada"] [--show-projects] [--theme bold|mono|pastel] [--out <dir>]
|
|
23
30
|
wrapt schema [--validate <narrative.json>]
|
|
24
31
|
wrapt share [--year 2026] [--minutes 15] [--port <n>]
|
|
32
|
+
wrapt airdrop [--year 2026] [--set story|carousel|all]
|
|
33
|
+
wrapt open [--year 2026] [--set story|carousel]
|
|
25
34
|
wrapt publish --repo <owner/name> [--branch gh-pages] [--url <base>] [--dry-run] [--yes] [--remove]
|
|
26
35
|
|
|
27
36
|
Commands
|
|
28
|
-
analyze Read Claude Code (and GitHub Copilot) history and
|
|
29
|
-
render
|
|
37
|
+
analyze Read Claude Code (and GitHub Copilot) history and save your stats privately in ~/.wrapt/<year>/
|
|
38
|
+
render Make the cards in ./wrapt-<year>/ in the current folder: story and carousel PNGs, a ZIP of
|
|
39
|
+
each, linkedin.pdf and x-card.png
|
|
30
40
|
schema Print the JSON Schema for narrative.json, or --validate a file against it
|
|
31
41
|
share Serve the cards on your Wi-Fi and show a QR code to open them on your phone. No upload.
|
|
42
|
+
airdrop Mac only: AirDrop the cards to your iPhone, where they go straight into Photos.
|
|
43
|
+
open Open ./wrapt-<year>/ with your cards and ZIPs (Finder, File Explorer or your file manager).
|
|
32
44
|
publish Opt-in: put the cards on GitHub Pages (a gh-pages branch in YOUR repo) with link previews.
|
|
33
45
|
Uploads only the rendered images, PDF and page. --remove takes the year down again.
|
|
34
46
|
|
|
@@ -38,7 +50,10 @@ Options
|
|
|
38
50
|
copilot-vscode, copilot-cli, or a comma list
|
|
39
51
|
--json Print stats.json to stdout instead of the summary
|
|
40
52
|
--projects-dir Claude Code projects dir (default: ~/.claude/projects)
|
|
41
|
-
--out
|
|
53
|
+
--out Where the cards go, and where share/airdrop/open/publish look for them
|
|
54
|
+
(default: ./wrapt-<year> in the folder you run wrapt from)
|
|
55
|
+
--data Where your private stats live (default: ~/.wrapt/<year>). Never shared.
|
|
56
|
+
--samples analyze: also save samples.json, prompt excerpts for the /wrapt skill. Off by default.
|
|
42
57
|
--name Name for the cover (default: "Your 2026 with Claude")
|
|
43
58
|
--show-projects Put your real project names on the cards (default: "Project A/B/C")
|
|
44
59
|
--theme Colour theme: ${Object.keys(THEMES).join(", ")} (default: bold)
|
|
@@ -54,6 +69,8 @@ async function main(argv) {
|
|
|
54
69
|
"projects-dir": { type: "string" },
|
|
55
70
|
source: { type: "string" },
|
|
56
71
|
out: { type: "string" },
|
|
72
|
+
data: { type: "string" },
|
|
73
|
+
samples: { type: "boolean", default: false },
|
|
57
74
|
name: { type: "string" },
|
|
58
75
|
"show-projects": { type: "boolean", default: false },
|
|
59
76
|
// Older flag: project names are hidden by default now, so this is a no-op kept for scripts.
|
|
@@ -61,6 +78,7 @@ async function main(argv) {
|
|
|
61
78
|
theme: { type: "string" },
|
|
62
79
|
validate: { type: "string" },
|
|
63
80
|
minutes: { type: "string" },
|
|
81
|
+
set: { type: "string" },
|
|
64
82
|
repo: { type: "string" },
|
|
65
83
|
branch: { type: "string" },
|
|
66
84
|
url: { type: "string" },
|
|
@@ -79,9 +97,27 @@ async function main(argv) {
|
|
|
79
97
|
const year = values.year ? Number(values.year) : new Date().getFullYear();
|
|
80
98
|
if (!Number.isInteger(year) || year < 2000 || year > 3000)
|
|
81
99
|
throw new Error(`Invalid --year: ${values.year}`);
|
|
100
|
+
/** The full command to run next, keeping --year/--out/--data so it finds the same cards. */
|
|
101
|
+
const next = (sub) => `npx wrapt-cli ${sub}${values.year ? ` --year ${year}` : ""}${values.out ? ` --out "${values.out}"` : ""}${values.data ? ` --data "${values.data}"` : ""}`;
|
|
102
|
+
// Two folders, kept apart so the private one never gets shared by accident:
|
|
103
|
+
// cardsDir: the cards, in the folder the command runs from (./wrapt-<year>) unless --out says otherwise
|
|
104
|
+
// dataDir: stats.json, samples.json, narrative.json, report.md, render.json, in ~/.wrapt/<year>
|
|
105
|
+
const cardsDir = path.resolve(values.out ?? `wrapt-${year}`);
|
|
106
|
+
const homeDataDir = path.join(wraptHome(), String(year));
|
|
107
|
+
// A folder given with --out that already holds stats.json (scripts, tests) is used for both.
|
|
108
|
+
const dataDir = values.data ?? (values.out && fs.existsSync(path.join(cardsDir, "stats.json")) ? cardsDir : homeDataDir);
|
|
109
|
+
/** Where existing cards are: ./wrapt-<year>, or ~/.wrapt/<year> for cards made before wrapt 0.1.4. */
|
|
110
|
+
const findCards = () => {
|
|
111
|
+
if (values.out || fs.existsSync(path.join(cardsDir, "story")))
|
|
112
|
+
return cardsDir;
|
|
113
|
+
if (fs.existsSync(path.join(homeDataDir, "story")))
|
|
114
|
+
return homeDataDir;
|
|
115
|
+
throw new Error(`No cards in ${shown(cardsDir)}. Run \`${next("render")}\` here first, or cd to the folder where you ran it.`);
|
|
116
|
+
};
|
|
82
117
|
switch (cmd) {
|
|
83
118
|
case "analyze": {
|
|
84
|
-
|
|
119
|
+
// --out is accepted here for older scripts, where it meant the stats folder.
|
|
120
|
+
const res = await analyze({ year, projectsDir: values["projects-dir"], outDir: values.data ?? values.out, source: values.source, samples: values.samples });
|
|
85
121
|
if (values.json)
|
|
86
122
|
process.stdout.write(JSON.stringify(res.stats, null, 2) + "\n");
|
|
87
123
|
else
|
|
@@ -92,13 +128,13 @@ async function main(argv) {
|
|
|
92
128
|
return;
|
|
93
129
|
}
|
|
94
130
|
case "render": {
|
|
95
|
-
const dir =
|
|
96
|
-
const statsPath = path.join(
|
|
131
|
+
const dir = cardsDir;
|
|
132
|
+
const statsPath = path.join(dataDir, "stats.json");
|
|
97
133
|
if (!fs.existsSync(statsPath))
|
|
98
|
-
throw new Error(`No ${
|
|
134
|
+
throw new Error(`No stats for ${year} yet. Run \`${next("analyze")}\` first.`);
|
|
99
135
|
const stats = StatsSchema.parse(JSON.parse(fs.readFileSync(statsPath, "utf8")));
|
|
100
136
|
let narrative;
|
|
101
|
-
const narrativePath = path.join(
|
|
137
|
+
const narrativePath = path.join(dataDir, "narrative.json");
|
|
102
138
|
if (fs.existsSync(narrativePath)) {
|
|
103
139
|
const parsed = NarrativeSchema.safeParse(JSON.parse(fs.readFileSync(narrativePath, "utf8")));
|
|
104
140
|
if (parsed.success)
|
|
@@ -107,23 +143,40 @@ async function main(argv) {
|
|
|
107
143
|
process.stderr.write(`Ignoring invalid narrative.json:\n${parsed.error.message}\n`);
|
|
108
144
|
}
|
|
109
145
|
const t0 = Date.now();
|
|
110
|
-
const res = await renderAll({ stats, narrative, name: values.name, hideProjects: values["hide-projects"] || !values["show-projects"], theme: values.theme, outDir: dir });
|
|
146
|
+
const res = await renderAll({ stats, narrative, name: values.name, hideProjects: values["hide-projects"] || !values["show-projects"], theme: values.theme, outDir: dir, infoDir: dataDir });
|
|
147
|
+
// Every card of a set in one file, for downloading or sending in one go.
|
|
148
|
+
const zipNames = [];
|
|
149
|
+
for (const [set, buf] of Object.entries(cardZips(dir, year, collectAssets(dir)))) {
|
|
150
|
+
const name = `wrapt-${year}-${set}.zip`;
|
|
151
|
+
fs.writeFileSync(path.join(dir, name), buf);
|
|
152
|
+
zipNames.push(name);
|
|
153
|
+
}
|
|
154
|
+
const n = res.story.length;
|
|
155
|
+
const row = (left, right) => ` ${left.padEnd(26)}${right}`;
|
|
111
156
|
process.stdout.write([
|
|
112
157
|
"",
|
|
113
|
-
`
|
|
114
|
-
|
|
115
|
-
`
|
|
116
|
-
|
|
117
|
-
|
|
158
|
+
` ✓ Your cards are ready (${((Date.now() - t0) / 1000).toFixed(1)}s)${narrative ? "" : ". Card 4 shows your week, and the archetype comes from your rhythm."}`,
|
|
159
|
+
"",
|
|
160
|
+
` Saved in ${shown(dir)}`,
|
|
161
|
+
row("story/", `${n} Instagram Story cards (1080 × 1920)`),
|
|
162
|
+
row("carousel/", `${res.carousel.length} Instagram carousel cards (1080 × 1350)`),
|
|
163
|
+
...zipNames.map((z) => row(z, `all the ${z.includes("story") ? "story" : "carousel"} cards in one file`)),
|
|
164
|
+
row(path.basename(res.pdf), "LinkedIn document post"),
|
|
165
|
+
row(path.basename(res.xCard), "X post"),
|
|
166
|
+
"",
|
|
167
|
+
" Next",
|
|
168
|
+
row("Open the folder:", next("open")),
|
|
169
|
+
row("Send them to your phone:", next("share")),
|
|
170
|
+
...(process.platform === "darwin" ? [row("Mac + iPhone:", next("airdrop"))] : []),
|
|
118
171
|
"",
|
|
119
172
|
` When you post, link ${SITE_URL} so people can make their own.`,
|
|
120
|
-
|
|
173
|
+
...(dataDir !== dir ? [` Your private stats stay in ${shown(dataDir)} and are never shared.`] : []),
|
|
121
174
|
"",
|
|
122
175
|
].join("\n") + "\n");
|
|
123
176
|
return;
|
|
124
177
|
}
|
|
125
178
|
case "share": {
|
|
126
|
-
const dir =
|
|
179
|
+
const dir = findCards();
|
|
127
180
|
const minutes = values.minutes ? Number(values.minutes) : 15;
|
|
128
181
|
if (!(minutes > 0 && minutes <= 120))
|
|
129
182
|
throw new Error("--minutes must be between 1 and 120");
|
|
@@ -148,6 +201,7 @@ async function main(argv) {
|
|
|
148
201
|
` ${share.url}`,
|
|
149
202
|
share.lan ? "" : " ! No Wi-Fi/LAN address found, so only this computer can open the link.",
|
|
150
203
|
` Serving only your rendered cards and PDF. Nothing is uploaded. Stops in ${minutes} min or on Ctrl+C.`,
|
|
204
|
+
...(process.platform === "darwin" ? [" Sending to an iPhone? In another terminal, `npx wrapt-cli airdrop` saves them straight to Photos."] : []),
|
|
151
205
|
"",
|
|
152
206
|
].join("\n") + "\n");
|
|
153
207
|
const stop = () => {
|
|
@@ -164,7 +218,6 @@ async function main(argv) {
|
|
|
164
218
|
return;
|
|
165
219
|
}
|
|
166
220
|
case "publish": {
|
|
167
|
-
const dir = values.out ?? path.join(wraptHome(), String(year));
|
|
168
221
|
const branch = values.branch ?? "gh-pages";
|
|
169
222
|
if (!values.repo && !values["dry-run"])
|
|
170
223
|
throw new Error("Pass --repo <owner/name> (an existing GitHub repo you can push to), or --dry-run.");
|
|
@@ -188,13 +241,15 @@ async function main(argv) {
|
|
|
188
241
|
process.stdout.write(changed ? ` Removed ${target.pageUrl}\n` : ` Nothing to remove for ${year}.\n`);
|
|
189
242
|
return;
|
|
190
243
|
}
|
|
191
|
-
const
|
|
244
|
+
const dir = findCards();
|
|
245
|
+
const statsPath = path.join(dataDir, "stats.json");
|
|
192
246
|
if (!fs.existsSync(statsPath))
|
|
193
|
-
throw new Error(`No ${
|
|
247
|
+
throw new Error(`No stats for ${year} yet. Run \`${next("analyze")}\` and \`${next("render")}\` first.`);
|
|
194
248
|
const stats = StatsSchema.parse(JSON.parse(fs.readFileSync(statsPath, "utf8")));
|
|
195
249
|
const renderInfo = (() => {
|
|
196
250
|
try {
|
|
197
|
-
|
|
251
|
+
const info = [dataDir, dir].map((d) => path.join(d, "render.json")).find((f) => fs.existsSync(f)) ?? "";
|
|
252
|
+
return JSON.parse(fs.readFileSync(info, "utf8"));
|
|
198
253
|
}
|
|
199
254
|
catch {
|
|
200
255
|
return {};
|
|
@@ -204,7 +259,7 @@ async function main(argv) {
|
|
|
204
259
|
const L = [
|
|
205
260
|
"",
|
|
206
261
|
` Site built: ${siteDir} (${files.length} files)`,
|
|
207
|
-
" Contains only: story + carousel PNGs, linkedin.pdf, x-card.png, index.html, font.",
|
|
262
|
+
" Contains only: story + carousel PNGs (plus a ZIP of each), linkedin.pdf, x-card.png, index.html, font.",
|
|
208
263
|
" Never uploaded: stats.json, samples.json, narrative.json, report.md.",
|
|
209
264
|
];
|
|
210
265
|
const projects = stats.stack.projects.slice(0, 3).map((p) => p.name);
|
|
@@ -213,13 +268,20 @@ async function main(argv) {
|
|
|
213
268
|
}
|
|
214
269
|
process.stdout.write(L.join("\n") + "\n");
|
|
215
270
|
if (values["dry-run"]) {
|
|
216
|
-
process.stdout.write(`\n Dry run: nothing uploaded. Open ${path.join(siteDir, "index.html")} to preview.\n`);
|
|
271
|
+
process.stdout.write(`\n Dry run: nothing uploaded. Open ${path.join(siteDir, "index.html")} to preview (a temporary copy).\n`);
|
|
217
272
|
return;
|
|
218
273
|
}
|
|
274
|
+
const cleanup = () => fs.rmSync(siteDir, { recursive: true, force: true });
|
|
219
275
|
process.stdout.write(`\n This makes the cards PUBLIC at ${target.pageUrl}\n (pushed to ${target.remote}, branch ${branch}). You can undo it with --remove.\n`);
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
276
|
+
let changed;
|
|
277
|
+
try {
|
|
278
|
+
if (!(await confirm(" Publish? [y/N] ")))
|
|
279
|
+
return void process.stdout.write(" Cancelled. Nothing was uploaded.\n");
|
|
280
|
+
changed = pushSite({ remote: target.remote, branch, year, siteDir, message: `wrapt: publish ${year} cards` });
|
|
281
|
+
}
|
|
282
|
+
finally {
|
|
283
|
+
cleanup();
|
|
284
|
+
}
|
|
223
285
|
process.stdout.write([
|
|
224
286
|
"",
|
|
225
287
|
changed ? ` ✓ Published → ${target.pageUrl}` : ` Already up to date → ${target.pageUrl}`,
|
|
@@ -229,6 +291,52 @@ async function main(argv) {
|
|
|
229
291
|
].join("\n") + "\n");
|
|
230
292
|
return;
|
|
231
293
|
}
|
|
294
|
+
case "airdrop": {
|
|
295
|
+
const set = values.set ?? "story";
|
|
296
|
+
if (!["story", "carousel", "all"].includes(set))
|
|
297
|
+
throw new Error("--set must be story, carousel or all");
|
|
298
|
+
if (process.platform !== "darwin") {
|
|
299
|
+
throw new Error("AirDrop needs a Mac. Use `wrapt share` instead: it shows a QR code to open the cards on your phone.");
|
|
300
|
+
}
|
|
301
|
+
const dir = findCards();
|
|
302
|
+
const assets = collectAssets(dir);
|
|
303
|
+
const rels = set === "story" ? assets.story : set === "carousel" ? assets.carousel : [...assets.story, ...assets.carousel, ...(assets.xCard ? [assets.xCard] : [])];
|
|
304
|
+
if (!rels.length)
|
|
305
|
+
throw new Error(`No cards in ${dir}. Run \`wrapt render\` first.`);
|
|
306
|
+
process.stdout.write([
|
|
307
|
+
"",
|
|
308
|
+
` Opening AirDrop with ${rels.length} ${set === "all" ? "cards" : `${set} cards`}…`,
|
|
309
|
+
" 1. In the AirDrop window on your Mac, pick your iPhone.",
|
|
310
|
+
" 2. On your iPhone, tap Accept. The cards go straight into Photos.",
|
|
311
|
+
" (Your iPhone needs AirDrop on: Settings → General → AirDrop → Contacts Only or Everyone.)",
|
|
312
|
+
"",
|
|
313
|
+
].join("\n") + "\n");
|
|
314
|
+
const result = await airdrop(rels.map((r) => path.join(dir, r)));
|
|
315
|
+
const messages = {
|
|
316
|
+
sent: ` ✓ Sent ${rels.length} cards. Check the Photos app on your iPhone.`,
|
|
317
|
+
cancelled: " AirDrop was closed before sending. Run it again when you're ready.",
|
|
318
|
+
timeout: " Stopped waiting after 10 minutes. Run it again when you're ready.",
|
|
319
|
+
unavailable: " AirDrop isn't available. Check that Wi-Fi and Bluetooth are on, or use `wrapt share` instead.",
|
|
320
|
+
};
|
|
321
|
+
process.stdout.write((messages[result] ?? ` AirDrop ${result}. Try again, or use \`wrapt share\` instead.`) + "\n");
|
|
322
|
+
if (result !== "sent")
|
|
323
|
+
process.exitCode = 1;
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
case "open": {
|
|
327
|
+
const set = values.set;
|
|
328
|
+
if (set && !["story", "carousel"].includes(set))
|
|
329
|
+
throw new Error("--set must be story or carousel");
|
|
330
|
+
const dir = findCards();
|
|
331
|
+
const target = set ? path.join(dir, set) : dir;
|
|
332
|
+
if (!fs.existsSync(target))
|
|
333
|
+
throw new Error(`No ${set} cards in ${shown(dir)}. Run \`${next("render")}\` first.`);
|
|
334
|
+
const opened = await openFolder(target);
|
|
335
|
+
process.stdout.write(opened
|
|
336
|
+
? ` Opened ${shown(target)}\n`
|
|
337
|
+
: ` Couldn't open a file browser here. Your cards are in:\n ${target}\n`);
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
232
340
|
case "schema": {
|
|
233
341
|
if (!values.validate) {
|
|
234
342
|
process.stdout.write(JSON.stringify(narrativeJsonSchema(), null, 2) + "\n");
|
package/dist/format.js
CHANGED
|
@@ -79,7 +79,8 @@ export function summary(s, paths) {
|
|
|
79
79
|
const excluded = Object.values(p.excludedUser).reduce((a, b) => a + b, 0);
|
|
80
80
|
L.push(dim(` parsed ${p.files} files · ${p.lines} lines · ${p.malformed} malformed · ${p.duplicates} duplicates · ${skipped} non-chat lines · ${excluded} non-prompt user lines`));
|
|
81
81
|
L.push(dim(` → ${paths.stats}`));
|
|
82
|
-
|
|
82
|
+
if (paths.samples)
|
|
83
|
+
L.push(dim(` → ${paths.samples} (private, stays on this machine)`));
|
|
83
84
|
L.push("");
|
|
84
85
|
return L.join("\n");
|
|
85
86
|
}
|
package/dist/open.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import os from "node:os";
|
|
3
|
+
/** The command that opens a folder in the system's file browser (Finder, File Explorer, or the Linux default). */
|
|
4
|
+
export function openerFor(platform, dir) {
|
|
5
|
+
if (platform === "darwin")
|
|
6
|
+
return ["open", [dir]];
|
|
7
|
+
if (platform === "win32")
|
|
8
|
+
return ["explorer.exe", [dir]];
|
|
9
|
+
return ["xdg-open", [dir]];
|
|
10
|
+
}
|
|
11
|
+
/** Opens `dir` in the file browser. Resolves false if no file browser could be started. */
|
|
12
|
+
export function openFolder(dir, platform = process.platform) {
|
|
13
|
+
const [cmd, args] = openerFor(platform, dir);
|
|
14
|
+
return new Promise((resolve) => {
|
|
15
|
+
try {
|
|
16
|
+
const child = spawn(cmd, args, { detached: true, stdio: "ignore" });
|
|
17
|
+
child.once("error", () => resolve(false));
|
|
18
|
+
child.once("spawn", () => {
|
|
19
|
+
child.unref();
|
|
20
|
+
resolve(true);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
resolve(false);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
/** "/Users/ada/.wrapt/2026" -> "~/.wrapt/2026", for shorter, copyable output. */
|
|
29
|
+
export function tildify(p, home = os.homedir()) {
|
|
30
|
+
return p === home || p.startsWith(home + "/") ? "~" + p.slice(home.length) : p;
|
|
31
|
+
}
|
package/dist/publish.js
CHANGED
|
@@ -7,7 +7,7 @@ import { brandFor } from "./brand.js";
|
|
|
7
7
|
import { human } from "./format.js";
|
|
8
8
|
import { possessive } from "./render/cards.js";
|
|
9
9
|
import { sharePage } from "./share/page.js";
|
|
10
|
-
import { collectAssets } from "./share/server.js";
|
|
10
|
+
import { cardZips, collectAssets } from "./share/server.js";
|
|
11
11
|
const FONT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../assets/fonts/SpaceGrotesk-Bold.ttf");
|
|
12
12
|
/**
|
|
13
13
|
* "owner/name", "git@github.com:owner/name.git", "https://github.com/owner/name" or a local
|
|
@@ -42,8 +42,8 @@ export function buildSite(o) {
|
|
|
42
42
|
const assets = collectAssets(o.dir);
|
|
43
43
|
if (!assets.story.length || !assets.xCard)
|
|
44
44
|
throw new Error(`No rendered cards in ${o.dir}. Run \`wrapt render\` first.`);
|
|
45
|
-
|
|
46
|
-
fs.
|
|
45
|
+
// Built in a temporary folder, never next to the cards, so no copy is left behind after publishing.
|
|
46
|
+
const siteDir = fs.mkdtempSync(path.join(os.tmpdir(), "wrapt-site-"));
|
|
47
47
|
const files = [];
|
|
48
48
|
const copy = (rel, from = path.join(o.dir, rel)) => {
|
|
49
49
|
fs.mkdirSync(path.dirname(path.join(siteDir, rel)), { recursive: true });
|
|
@@ -54,6 +54,13 @@ export function buildSite(o) {
|
|
|
54
54
|
if (rel)
|
|
55
55
|
copy(rel);
|
|
56
56
|
copy("font.ttf", FONT);
|
|
57
|
+
const zips = {};
|
|
58
|
+
for (const [set, buf] of Object.entries(cardZips(o.dir, o.stats.year, assets))) {
|
|
59
|
+
const rel = `wrapt-${o.stats.year}-${set}.zip`;
|
|
60
|
+
fs.writeFileSync(path.join(siteDir, rel), buf);
|
|
61
|
+
files.push(rel);
|
|
62
|
+
zips[set] = rel;
|
|
63
|
+
}
|
|
57
64
|
const brand = brandFor(o.stats);
|
|
58
65
|
const t = o.stats.totals;
|
|
59
66
|
const who = possessive(o.name);
|
|
@@ -68,6 +75,7 @@ export function buildSite(o) {
|
|
|
68
75
|
fontUrl: "font.ttf",
|
|
69
76
|
heading: `${esc(who)} <em>${o.stats.year}</em>, wrapped.`,
|
|
70
77
|
og: { title, description, image: `${o.pageUrl}${assets.xCard}`, url: o.pageUrl },
|
|
78
|
+
zips,
|
|
71
79
|
});
|
|
72
80
|
fs.writeFileSync(path.join(siteDir, "index.html"), html);
|
|
73
81
|
files.push("index.html");
|
package/dist/render/index.js
CHANGED
|
@@ -54,7 +54,8 @@ export async function renderAll(opts) {
|
|
|
54
54
|
fs.writeFileSync(out.xCard, await toPng(Outro(ctxFor(SIZES.x, CARDS.length - 1)), SIZES.x));
|
|
55
55
|
fs.writeFileSync(out.pdf, await carouselPdf(carouselPngs, opts.stats.year, brandFor(opts.stats).long));
|
|
56
56
|
// Remember how the cards were made, so `wrapt publish` can warn before project names go public.
|
|
57
|
-
fs.writeFileSync(path.join(opts.outDir, "render.json"), JSON.stringify({ name: opts.name ?? null, hideProjects: opts.hideProjects ?? true, theme: opts.theme ?? "bold", renderedAt: new Date().toISOString() }, null, 2) + "\n");
|
|
57
|
+
fs.writeFileSync(path.join(opts.infoDir ?? opts.outDir, "render.json"), JSON.stringify({ name: opts.name ?? null, hideProjects: opts.hideProjects ?? true, theme: opts.theme ?? "bold", renderedAt: new Date().toISOString() }, null, 2) + "\n", { mode: 0o600 });
|
|
58
|
+
fs.chmodSync(path.join(opts.infoDir ?? opts.outDir, "render.json"), 0o600); // also when the file already existed
|
|
58
59
|
return out;
|
|
59
60
|
}
|
|
60
61
|
/** One carousel card per page at its pixel size — LinkedIn renders PDFs as swipeable documents. */
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
/**
|
|
3
|
+
* Opens macOS's AirDrop panel with the given files, so a Mac user can send every card to their
|
|
4
|
+
* iPhone in one go, where they land straight in Photos. Uses the system's own sharing service
|
|
5
|
+
* through JavaScript for Automation (osascript), so nothing extra is installed and nothing goes
|
|
6
|
+
* over the internet: AirDrop is a direct device-to-device transfer.
|
|
7
|
+
*/
|
|
8
|
+
const SCRIPT = `
|
|
9
|
+
ObjC.import('AppKit');
|
|
10
|
+
function run(argv) {
|
|
11
|
+
var timeoutSec = parseInt(argv.shift(), 10);
|
|
12
|
+
var app = $.NSApplication.sharedApplication;
|
|
13
|
+
app.setActivationPolicy($.NSApplicationActivationPolicyAccessory);
|
|
14
|
+
var svc = $.NSSharingService.sharingServiceNamed('com.apple.share.AirDrop.send');
|
|
15
|
+
if (!svc || svc.isNil()) return 'unavailable';
|
|
16
|
+
var items = $.NSMutableArray.array;
|
|
17
|
+
argv.forEach(function (p) { items.addObject($.NSURL.fileURLWithPath(p)); });
|
|
18
|
+
if (!svc.canPerformWithItems(items)) return 'unavailable';
|
|
19
|
+
var result = null;
|
|
20
|
+
ObjC.registerSubclass({
|
|
21
|
+
name: 'WraptAirDropDelegate',
|
|
22
|
+
protocols: ['NSSharingServiceDelegate'],
|
|
23
|
+
methods: {
|
|
24
|
+
'sharingService:didShareItems:': { types: ['void', ['id', 'id']], implementation: function () { result = 'sent'; } },
|
|
25
|
+
'sharingService:didFailToShareItems:error:': { types: ['void', ['id', 'id', 'id']], implementation: function (s, i, e) {
|
|
26
|
+
result = e.code == 3072 ? 'cancelled' : 'failed: ' + ObjC.unwrap(e.localizedDescription);
|
|
27
|
+
} }
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
svc.delegate = $.WraptAirDropDelegate.alloc.init;
|
|
31
|
+
app.activateIgnoringOtherApps(true);
|
|
32
|
+
svc.performWithItems(items);
|
|
33
|
+
var deadline = Date.now() + timeoutSec * 1000;
|
|
34
|
+
while (result === null && Date.now() < deadline) {
|
|
35
|
+
$.NSRunLoop.currentRunLoop.runUntilDate($.NSDate.dateWithTimeIntervalSinceNow(0.2));
|
|
36
|
+
}
|
|
37
|
+
return result || 'timeout';
|
|
38
|
+
}
|
|
39
|
+
`;
|
|
40
|
+
const run = (cmd, args) => new Promise((resolve, reject) => execFile(cmd, args, { maxBuffer: 1 << 20 }, (err, stdout, stderr) => {
|
|
41
|
+
if (!err)
|
|
42
|
+
return resolve(stdout);
|
|
43
|
+
// err.message repeats the whole command line (the script and every path), so keep it short.
|
|
44
|
+
const why = stderr.trim().split("\n").pop() || (err.signal ? `stopped (${err.signal})` : `exited with code ${err.code}`);
|
|
45
|
+
reject(new Error(`AirDrop ${why}`));
|
|
46
|
+
}));
|
|
47
|
+
/** The osascript command line that opens AirDrop with `files`. */
|
|
48
|
+
export function airdropArgs(files, timeoutSec) {
|
|
49
|
+
return ["-l", "JavaScript", "-e", SCRIPT, String(timeoutSec), ...files];
|
|
50
|
+
}
|
|
51
|
+
/** Opens the AirDrop panel with `files` and waits until they're sent, cancelled or `timeoutSec` passes. */
|
|
52
|
+
export async function airdrop(files, opts = {}) {
|
|
53
|
+
if ((opts.platform ?? process.platform) !== "darwin")
|
|
54
|
+
return "unavailable";
|
|
55
|
+
if (!files.length)
|
|
56
|
+
throw new Error("No files to send.");
|
|
57
|
+
const out = await (opts.exec ?? run)("osascript", airdropArgs(files, opts.timeoutSec ?? 600));
|
|
58
|
+
return out.trim();
|
|
59
|
+
}
|
package/dist/share/page.js
CHANGED
|
@@ -148,6 +148,8 @@ ${a.carousel.length
|
|
|
148
148
|
<script>
|
|
149
149
|
(function () {
|
|
150
150
|
var sets = ${JSON.stringify({ story: a.story.map(f), carousel: a.carousel.map(f) })};
|
|
151
|
+
var zips = ${JSON.stringify(o.zips ?? {})};
|
|
152
|
+
var YEAR = ${JSON.stringify(o.year)};
|
|
151
153
|
var LOCAL = ${local ? "true" : "false"};
|
|
152
154
|
var ua = navigator.userAgent;
|
|
153
155
|
var iOS = /iPhone|iPad|iPod/.test(ua) || (navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1);
|
|
@@ -167,14 +169,12 @@ ${a.carousel.length
|
|
|
167
169
|
return true;
|
|
168
170
|
}
|
|
169
171
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
a.href = LOCAL ? u + "?dl=1" : u; a.download = ""; document.body.appendChild(a); a.click(); a.remove();
|
|
175
|
-
}, i * 400);
|
|
176
|
-
});
|
|
172
|
+
// One file, one download: browsers block or ask about a burst of separate downloads.
|
|
173
|
+
function downloadZip(url, filename) {
|
|
174
|
+
var a = document.createElement("a");
|
|
175
|
+
a.href = url; a.download = filename; document.body.appendChild(a); a.click(); a.remove();
|
|
177
176
|
}
|
|
177
|
+
var touch = navigator.maxTouchPoints > 0 || "ontouchstart" in window;
|
|
178
178
|
|
|
179
179
|
// This page is plain HTTP on the local network, where navigator.clipboard is unavailable; fall back to execCommand.
|
|
180
180
|
document.querySelectorAll("button[data-cap]").forEach(function (btn) {
|
|
@@ -196,18 +196,25 @@ ${a.carousel.length
|
|
|
196
196
|
var urls = sets[name];
|
|
197
197
|
btn.disabled = true;
|
|
198
198
|
try {
|
|
199
|
-
//
|
|
200
|
-
if (window.isSecureContext && navigator.share && (await shareFiles(urls))) return;
|
|
199
|
+
// On a phone over HTTPS, the share sheet saves every card straight to Photos in one go.
|
|
200
|
+
if (touch && window.isSecureContext && navigator.share && (await shareFiles(urls))) return;
|
|
201
201
|
} catch (e) {
|
|
202
202
|
if (e && e.name === "AbortError") return;
|
|
203
203
|
} finally {
|
|
204
204
|
btn.disabled = false;
|
|
205
205
|
}
|
|
206
|
+
var file = "wrapt-" + YEAR + "-" + name + ".zip";
|
|
207
|
+
if (!zips[name]) {
|
|
208
|
+
hint(name, "Use the <b>Save</b> button under each card.");
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
downloadZip(zips[name], file);
|
|
206
212
|
if (iOS) {
|
|
207
|
-
hint(name, "<b>
|
|
213
|
+
hint(name, "Saved <b>" + file + "</b> to <b>Files → Downloads</b>. Open it there to unzip, tap <b>Select</b> → select all → <b>Share</b> → <b>Save " + urls.length + " Images</b> to put them in Photos.");
|
|
214
|
+
} else if (touch) {
|
|
215
|
+
hint(name, "Saved <b>" + file + "</b> to your Downloads. Open it in your Files app and choose <b>Extract</b> to add the " + urls.length + " cards to your gallery.");
|
|
208
216
|
} else {
|
|
209
|
-
hint(name, "
|
|
210
|
-
downloadAll(urls);
|
|
217
|
+
hint(name, "Downloaded <b>" + file + "</b> with all " + urls.length + " cards.");
|
|
211
218
|
}
|
|
212
219
|
});
|
|
213
220
|
});
|
package/dist/share/server.js
CHANGED
|
@@ -7,6 +7,7 @@ import { fileURLToPath } from "node:url";
|
|
|
7
7
|
import { brandFor } from "../brand.js";
|
|
8
8
|
import { StatsSchema } from "../stats/schema.js";
|
|
9
9
|
import { sharePage } from "./page.js";
|
|
10
|
+
import { zip } from "./zip.js";
|
|
10
11
|
const FONT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../assets/fonts/SpaceGrotesk-Bold.ttf");
|
|
11
12
|
const TYPES = {
|
|
12
13
|
".png": "image/png",
|
|
@@ -50,6 +51,17 @@ export function collectAssets(dir) {
|
|
|
50
51
|
const maybe = (f) => (fs.existsSync(path.join(dir, f)) ? f : undefined);
|
|
51
52
|
return { story: pngs("story"), carousel: pngs("carousel"), pdf: maybe("linkedin.pdf"), xCard: maybe("x-card.png") };
|
|
52
53
|
}
|
|
54
|
+
/** One ZIP per card set ("story", "carousel"), named wrapt-<year>-<set>.zip with wrapt-<year>-<set>-01.png… inside. */
|
|
55
|
+
export function cardZips(dir, year, assets) {
|
|
56
|
+
const out = {};
|
|
57
|
+
for (const set of ["story", "carousel"]) {
|
|
58
|
+
const files = assets[set];
|
|
59
|
+
if (!files.length)
|
|
60
|
+
continue;
|
|
61
|
+
out[set] = zip(files.map((rel) => ({ name: `wrapt-${year}-${set}-${path.basename(rel)}`, data: fs.readFileSync(path.join(dir, rel)) })));
|
|
62
|
+
}
|
|
63
|
+
return out;
|
|
64
|
+
}
|
|
53
65
|
/** Names the tools behind this year's cards for the captions. Falls back to Claude Code when stats.json is missing or unreadable. */
|
|
54
66
|
function toolName(dir) {
|
|
55
67
|
try {
|
|
@@ -70,7 +82,15 @@ export async function startShare(opts) {
|
|
|
70
82
|
allowed.set(`/${token}/f/${rel}`, path.join(opts.dir, rel));
|
|
71
83
|
}
|
|
72
84
|
allowed.set(`/${token}/font.ttf`, FONT);
|
|
73
|
-
const
|
|
85
|
+
const zips = cardZips(opts.dir, opts.year, assets);
|
|
86
|
+
const zipPath = (set) => `/${token}/zip/wrapt-${opts.year}-${set}.zip`;
|
|
87
|
+
const zipByPath = new Map(Object.entries(zips).map(([set, buf]) => [zipPath(set), buf]));
|
|
88
|
+
const html = sharePage(assets, {
|
|
89
|
+
year: opts.year,
|
|
90
|
+
base: `/${token}`,
|
|
91
|
+
tool: toolName(opts.dir),
|
|
92
|
+
zips: Object.fromEntries(Object.keys(zips).map((set) => [set, zipPath(set)])),
|
|
93
|
+
});
|
|
74
94
|
const server = http.createServer((req, res) => {
|
|
75
95
|
const url = new URL(req.url ?? "/", "http://x");
|
|
76
96
|
res.setHeader("X-Content-Type-Options", "nosniff");
|
|
@@ -89,6 +109,17 @@ export async function startShare(opts) {
|
|
|
89
109
|
res.end(req.method === "HEAD" ? undefined : html);
|
|
90
110
|
return;
|
|
91
111
|
}
|
|
112
|
+
const zipBuf = zipByPath.get(url.pathname);
|
|
113
|
+
if (zipBuf) {
|
|
114
|
+
opts.onRequest?.(url.pathname.slice(token.length + 1));
|
|
115
|
+
res.writeHead(200, {
|
|
116
|
+
"Content-Type": "application/zip",
|
|
117
|
+
"Content-Length": String(zipBuf.length),
|
|
118
|
+
"Content-Disposition": `attachment; filename="${path.basename(url.pathname)}"`,
|
|
119
|
+
});
|
|
120
|
+
res.end(req.method === "HEAD" ? undefined : zipBuf);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
92
123
|
const file = allowed.get(url.pathname);
|
|
93
124
|
if (!file) {
|
|
94
125
|
res.writeHead(404, { "Content-Type": "text/plain" }).end("Not found");
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A minimal ZIP writer, so "Save all" can hand over every card as one download.
|
|
3
|
+
* Files are stored without compression: PNGs and PDFs are already compressed.
|
|
4
|
+
*/
|
|
5
|
+
const CRC_TABLE = (() => {
|
|
6
|
+
const t = new Uint32Array(256);
|
|
7
|
+
for (let n = 0; n < 256; n++) {
|
|
8
|
+
let c = n;
|
|
9
|
+
for (let k = 0; k < 8; k++)
|
|
10
|
+
c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1;
|
|
11
|
+
t[n] = c >>> 0;
|
|
12
|
+
}
|
|
13
|
+
return t;
|
|
14
|
+
})();
|
|
15
|
+
export function crc32(buf) {
|
|
16
|
+
let c = 0xffffffff;
|
|
17
|
+
for (let i = 0; i < buf.length; i++)
|
|
18
|
+
c = CRC_TABLE[(c ^ buf[i]) & 0xff] ^ (c >>> 8);
|
|
19
|
+
return (c ^ 0xffffffff) >>> 0;
|
|
20
|
+
}
|
|
21
|
+
/** DOS date/time for 2026-01-01 00:00, so archives are reproducible and carry no local timestamp. */
|
|
22
|
+
const DOS_TIME = 0;
|
|
23
|
+
const DOS_DATE = ((2026 - 1980) << 9) | (1 << 5) | 1;
|
|
24
|
+
export function zip(entries) {
|
|
25
|
+
const parts = [];
|
|
26
|
+
const central = [];
|
|
27
|
+
let offset = 0;
|
|
28
|
+
for (const e of entries) {
|
|
29
|
+
const name = Buffer.from(e.name, "utf8");
|
|
30
|
+
const crc = crc32(e.data);
|
|
31
|
+
const local = Buffer.alloc(30);
|
|
32
|
+
local.writeUInt32LE(0x04034b50, 0); // local file header
|
|
33
|
+
local.writeUInt16LE(20, 4); // version needed
|
|
34
|
+
local.writeUInt16LE(0x0800, 6); // flags: UTF-8 names
|
|
35
|
+
local.writeUInt16LE(0, 8); // method: stored
|
|
36
|
+
local.writeUInt16LE(DOS_TIME, 10);
|
|
37
|
+
local.writeUInt16LE(DOS_DATE, 12);
|
|
38
|
+
local.writeUInt32LE(crc, 14);
|
|
39
|
+
local.writeUInt32LE(e.data.length, 18);
|
|
40
|
+
local.writeUInt32LE(e.data.length, 22);
|
|
41
|
+
local.writeUInt16LE(name.length, 26);
|
|
42
|
+
local.writeUInt16LE(0, 28);
|
|
43
|
+
parts.push(local, name, e.data);
|
|
44
|
+
const cd = Buffer.alloc(46);
|
|
45
|
+
cd.writeUInt32LE(0x02014b50, 0); // central directory header
|
|
46
|
+
cd.writeUInt16LE(20, 4); // version made by
|
|
47
|
+
cd.writeUInt16LE(20, 6); // version needed
|
|
48
|
+
cd.writeUInt16LE(0x0800, 8);
|
|
49
|
+
cd.writeUInt16LE(0, 10);
|
|
50
|
+
cd.writeUInt16LE(DOS_TIME, 12);
|
|
51
|
+
cd.writeUInt16LE(DOS_DATE, 14);
|
|
52
|
+
cd.writeUInt32LE(crc, 16);
|
|
53
|
+
cd.writeUInt32LE(e.data.length, 20);
|
|
54
|
+
cd.writeUInt32LE(e.data.length, 24);
|
|
55
|
+
cd.writeUInt16LE(name.length, 28);
|
|
56
|
+
cd.writeUInt32LE(offset, 42);
|
|
57
|
+
central.push(cd, name);
|
|
58
|
+
offset += local.length + name.length + e.data.length;
|
|
59
|
+
}
|
|
60
|
+
const cdSize = central.reduce((n, b) => n + b.length, 0);
|
|
61
|
+
const end = Buffer.alloc(22);
|
|
62
|
+
end.writeUInt32LE(0x06054b50, 0); // end of central directory
|
|
63
|
+
end.writeUInt16LE(entries.length, 8);
|
|
64
|
+
end.writeUInt16LE(entries.length, 10);
|
|
65
|
+
end.writeUInt32LE(cdSize, 12);
|
|
66
|
+
end.writeUInt32LE(offset, 16);
|
|
67
|
+
return Buffer.concat([...parts, ...central, end]);
|
|
68
|
+
}
|