memory-extract 0.1.4 → 0.1.6

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 CHANGED
@@ -0,0 +1,81 @@
1
+ # memory-extract
2
+
3
+ Embed files into a PNG image and open them back from the PNG alone
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install memory-extract
9
+ ```
10
+
11
+ ## CLI
12
+
13
+ ### `memory-pack [path] [filename]`
14
+
15
+ Pack a file or directory into a memory PNG
16
+
17
+ ```bash
18
+ memory-pack # pack current directory → ./<folder-name>.png
19
+ memory-pack dist # pack ./dist → ./dist.png
20
+ memory-pack dist App # pack ./dist → ./App.png
21
+ ```
22
+
23
+
24
+ | Argument | Default | Description |
25
+ | ---------- | ------------------ | ----------------------------------------- |
26
+ | `path` | `.` | File or directory to pack |
27
+ | `filename` | basename of `path` | Output PNG name (`.png` added if missing) |
28
+
29
+
30
+
31
+ | Flag | Description |
32
+ | ---------------- | -------------------------------------------- |
33
+ | `--cover <path>` | Cover image instead of the default blank PNG |
34
+ | `--out <path>` | Output PNG path |
35
+
36
+
37
+
38
+
39
+ ### `memory-unpack <png> [out-dir]`
40
+
41
+ Extract the packed files from a memory PNG
42
+
43
+ ```bash
44
+ memory-unpack dist.png
45
+ memory-unpack dist.png ./restored
46
+ ```
47
+
48
+
49
+
50
+ ### `memory-play <png>`
51
+
52
+ Open a memory PNG in the browser
53
+
54
+ ```bash
55
+ memory-play App.png
56
+ ```
57
+
58
+ ## Library
59
+
60
+ Browser exports
61
+
62
+ ```js
63
+ import {
64
+ extractMemory,
65
+ listManifestFiles,
66
+ readMemoryFile,
67
+ createMemoryBlob,
68
+ } from "memory-extract";
69
+ ```
70
+
71
+
72
+
73
+ Node helpers
74
+
75
+ ```js
76
+ import { embedMemory, encodeMemoryPayload } from "memory-extract/node";
77
+ import { guessMimeType, encodeV2Archive } from "memory-extract/payload";
78
+ ```
79
+
80
+ `createMemoryBlob()` is for in-browser launch via blob URLs and the CLI uses HTTP or `file://`
81
+
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "memory-extract",
3
3
  "description": "Tool for embedding data into PNG images",
4
4
  "license": "MIT",
5
- "version": "0.1.4",
5
+ "version": "0.1.6",
6
6
  "author": "semigarden",
7
7
  "repository": {
8
8
  "type": "git",
package/tools/unpack.mjs CHANGED
@@ -27,7 +27,7 @@ const parseArgs = async (argv) => {
27
27
  const main = async () => {
28
28
  const { input, explicitOut, host } = await parseArgs(process.argv.slice(2));
29
29
  const buffer = await readFile(input);
30
- const { png, manifest, fileBytes, version } = extractMemory(buffer);
30
+ const { manifest, fileBytes, version } = extractMemory(buffer);
31
31
  const outDir = resolveUnpackDir({
32
32
  manifestSource: manifest.source ?? "",
33
33
  explicitOut,
@@ -35,7 +35,6 @@ const main = async () => {
35
35
  });
36
36
 
37
37
  await mkdir(outDir, { recursive: true });
38
- await writeFile(path.join(outDir, "cover.png"), png);
39
38
 
40
39
  for (const filePath of listManifestFiles(manifest)) {
41
40
  const target = resolveSafePath(
@@ -48,11 +47,6 @@ const main = async () => {
48
47
  await writeFile(target, readMemoryFile(manifest, filePath, fileBytes));
49
48
  }
50
49
 
51
- await writeFile(
52
- path.join(outDir, "manifest.json"),
53
- `${JSON.stringify(manifest, null, 2)}\n`
54
- );
55
-
56
50
  console.log(
57
51
  `Extracted ${listManifestFiles(manifest).length} files to ${outDir} (format v${version})`
58
52
  );