@flowscripter/flowscripter-io-cli 1.2.1 → 1.2.3
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/bun.lock +59 -59
- package/package.json +10 -10
- package/src/byteScale.ts +26 -0
- package/src/commands/copy.ts +5 -3
- package/src/commands/hash.ts +5 -3
- package/src/commands/move.ts +8 -2
- package/tests/byteScale_test.ts +29 -0
package/bun.lock
CHANGED
|
@@ -5,19 +5,19 @@
|
|
|
5
5
|
"": {
|
|
6
6
|
"name": "@flowscripter/flowscripter-io-cli",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@flowscripter/dynamic-cli-framework": "^5.4.
|
|
8
|
+
"@flowscripter/dynamic-cli-framework": "^5.4.8",
|
|
9
9
|
"@flowscripter/dynamic-cli-framework-api": "^2.3.4",
|
|
10
|
-
"@flowscripter/dynamic-plugin-framework": "^2.2.
|
|
11
|
-
"@flowscripter/flowscripter-io-cli-hash-native": "^1.0.
|
|
12
|
-
"@flowscripter/pluggable-io-framework": "^1.1.
|
|
13
|
-
"@flowscripter/pluggable-io-framework-api": "^1.0.
|
|
10
|
+
"@flowscripter/dynamic-plugin-framework": "^2.2.6",
|
|
11
|
+
"@flowscripter/flowscripter-io-cli-hash-native": "^1.0.3",
|
|
12
|
+
"@flowscripter/pluggable-io-framework": "^1.1.5",
|
|
13
|
+
"@flowscripter/pluggable-io-framework-api": "^1.0.9",
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@flowscripter/io-plugin-filesystem": "^1.0.
|
|
17
|
-
"@types/bun": "^1.4.
|
|
16
|
+
"@flowscripter/io-plugin-filesystem": "^1.0.6",
|
|
17
|
+
"@types/bun": "^1.4.2",
|
|
18
18
|
"@types/node": "^26.4.1",
|
|
19
|
-
"oxfmt": "0.
|
|
20
|
-
"oxlint": "1.
|
|
19
|
+
"oxfmt": "0.67.0",
|
|
20
|
+
"oxlint": "1.82.0",
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"typescript": "^7.0.2",
|
|
@@ -25,97 +25,97 @@
|
|
|
25
25
|
},
|
|
26
26
|
},
|
|
27
27
|
"packages": {
|
|
28
|
-
"@flowscripter/dynamic-cli-framework": ["@flowscripter/dynamic-cli-framework@5.4.
|
|
28
|
+
"@flowscripter/dynamic-cli-framework": ["@flowscripter/dynamic-cli-framework@5.4.8", "", { "dependencies": { "@flowscripter/dynamic-cli-framework-api": "^2.3.4", "@flowscripter/dynamic-plugin-framework": "^2.2.6", "emphasize": "^7.0.0", "fastest-levenshtein": "^1.0.16", "figlet": "^1.11.4", "highlight.js": "^11.12.0", "prettier": "^3.9.6", "semver": "^7.8.5", "supports-color": "^11.0.0", "supports-terminal-graphics": "^0.1.0" }, "peerDependencies": { "typescript": "^7.0.2" } }, "sha512-rBC5IfJicgOEjtv3dd9AYFUTv/m0RjoWkaBwfxA4xGBPMl9tnRLVMp90BFu20AM7dhR2TB11n1OmJGc3l2Ejaw=="],
|
|
29
29
|
|
|
30
30
|
"@flowscripter/dynamic-cli-framework-api": ["@flowscripter/dynamic-cli-framework-api@2.3.4", "", { "peerDependencies": { "typescript": "^7.0.2" } }, "sha512-IisiSF13BYxvnISWM4Y9OaKiTMulPJO/Q6Ahx1yzZdfnradCSwcZJVE3QeiMuP9mkiVF4/8LpJcn1DEm4UOqLA=="],
|
|
31
31
|
|
|
32
|
-
"@flowscripter/dynamic-plugin-framework": ["@flowscripter/dynamic-plugin-framework@2.2.
|
|
32
|
+
"@flowscripter/dynamic-plugin-framework": ["@flowscripter/dynamic-plugin-framework@2.2.6", "", { "dependencies": { "semver": "^7.8.5" }, "peerDependencies": { "typescript": "^7.0.2" } }, "sha512-21Rkr3zFJUsygMKEPvuts4Y3Xl5sqRgk6vjqb4R4DXg0bFx4B/nS1I8Msn1SJY09tLYR3PjMViXmtE2aF+kXCA=="],
|
|
33
33
|
|
|
34
|
-
"@flowscripter/flowscripter-io-cli-hash-native": ["@flowscripter/flowscripter-io-cli-hash-native@1.0.
|
|
34
|
+
"@flowscripter/flowscripter-io-cli-hash-native": ["@flowscripter/flowscripter-io-cli-hash-native@1.0.3", "", { "peerDependencies": { "typescript": "^7.0.2" } }, "sha512-ThKrrED3VA7AyEmZ2s/dqtgplNhyws3l+Jfht9SPP808OTPxxXc4z49+dWBMEXjvqslgHMO7896nF6z7OPDnlA=="],
|
|
35
35
|
|
|
36
|
-
"@flowscripter/io-plugin-filesystem": ["@flowscripter/io-plugin-filesystem@1.0.
|
|
36
|
+
"@flowscripter/io-plugin-filesystem": ["@flowscripter/io-plugin-filesystem@1.0.6", "", { "dependencies": { "@flowscripter/pluggable-io-framework-api": "^1.0.8", "zod": "^4.5.4" }, "peerDependencies": { "@flowscripter/dynamic-plugin-framework": "*", "typescript": "^7.0.2" } }, "sha512-zGDqJ//OGMwoDOhz4BhvjXRXf3tknZVk0kKshmqlWoLMpD0u83SiqwIMU0n1lF+DMfXoN1MaWM9BO8D9F/eDqg=="],
|
|
37
37
|
|
|
38
|
-
"@flowscripter/pluggable-io-framework": ["@flowscripter/pluggable-io-framework@1.1.
|
|
38
|
+
"@flowscripter/pluggable-io-framework": ["@flowscripter/pluggable-io-framework@1.1.5", "", { "dependencies": { "@flowscripter/dynamic-plugin-framework": "^2.2.6", "@flowscripter/pluggable-io-framework-api": "^1.0.9" }, "peerDependencies": { "typescript": "^7.0.2" } }, "sha512-p+jvaTVEgS3Fhz90cU7rAdl+AfwGPCWckhy4yofwKsLCCA8rvGvsiIqrb3VqUZyO1LCgKrmYP9TnSKICH9Bw/A=="],
|
|
39
39
|
|
|
40
|
-
"@flowscripter/pluggable-io-framework-api": ["@flowscripter/pluggable-io-framework-api@1.0.
|
|
40
|
+
"@flowscripter/pluggable-io-framework-api": ["@flowscripter/pluggable-io-framework-api@1.0.9", "", { "dependencies": { "zod": "^4.6.1", "zod-to-json-schema": "^3.25.2" }, "peerDependencies": { "typescript": "^7.0.2" } }, "sha512-MyVaTD94kk8YUZfc2ont83EPLH6uCIdOqL/xFVUmNvDNidsqesLqF/1u8eC5UEcNmeHJrMhRkr0HtCrfwokeiA=="],
|
|
41
41
|
|
|
42
|
-
"@oxfmt/binding-android-arm-eabi": ["@oxfmt/binding-android-arm-eabi@0.
|
|
42
|
+
"@oxfmt/binding-android-arm-eabi": ["@oxfmt/binding-android-arm-eabi@0.67.0", "", { "os": "android", "cpu": "arm" }, "sha512-2olh3ioEmc4gRzQm7jxyB1b/PFBoFvTq8KdgYySeNpysDtA6DEg2Mvya4/I6flhL7G0eOrE8RD7JCNCIMhE16Q=="],
|
|
43
43
|
|
|
44
|
-
"@oxfmt/binding-android-arm64": ["@oxfmt/binding-android-arm64@0.
|
|
44
|
+
"@oxfmt/binding-android-arm64": ["@oxfmt/binding-android-arm64@0.67.0", "", { "os": "android", "cpu": "arm64" }, "sha512-ulfw8EHN1MBq/MFFDXw2/M1VAFu5mRUcnuZ8Hqbv9viAnFzO9t1jKSAsDqKYYDGMlytF/uj6Z5z5n/tHupnKhw=="],
|
|
45
45
|
|
|
46
|
-
"@oxfmt/binding-darwin-arm64": ["@oxfmt/binding-darwin-arm64@0.
|
|
46
|
+
"@oxfmt/binding-darwin-arm64": ["@oxfmt/binding-darwin-arm64@0.67.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-MfONZx/O2o9M5v2jDFol556G9+A+P9xCuJ4DZ+qhE+RnaCdoscy6Eu5nq1dbuNxhwdJyZ6kLI7fnG9mwEeOeGg=="],
|
|
47
47
|
|
|
48
|
-
"@oxfmt/binding-darwin-x64": ["@oxfmt/binding-darwin-x64@0.
|
|
48
|
+
"@oxfmt/binding-darwin-x64": ["@oxfmt/binding-darwin-x64@0.67.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-CYnIx5LvFVJnyJcCqwH2jxMKjFjqo5678MPjdmNFoSGMhlOvZ/xRZqvhDcolKrXc8fezW3AKh+C4wyoFuWOSSg=="],
|
|
49
49
|
|
|
50
|
-
"@oxfmt/binding-freebsd-x64": ["@oxfmt/binding-freebsd-x64@0.
|
|
50
|
+
"@oxfmt/binding-freebsd-x64": ["@oxfmt/binding-freebsd-x64@0.67.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-7/iF1orvIS9mxhKUqnmtMgm+OrSQ5acPwuvdQrm6ECgqbwPmC+Pw9cdke3sNfVN6pT2hbJ58+jP8BCThl5HXOg=="],
|
|
51
51
|
|
|
52
|
-
"@oxfmt/binding-linux-arm-gnueabihf": ["@oxfmt/binding-linux-arm-gnueabihf@0.
|
|
52
|
+
"@oxfmt/binding-linux-arm-gnueabihf": ["@oxfmt/binding-linux-arm-gnueabihf@0.67.0", "", { "os": "linux", "cpu": "arm" }, "sha512-yy+OGys07IZOpOmYPZoObKyUQLkfxeQqeCypk+1jaZd8HGo77hzvU1Jg8X3+W75o+9lszOjBfg0nkGtlwYywXw=="],
|
|
53
53
|
|
|
54
|
-
"@oxfmt/binding-linux-arm-musleabihf": ["@oxfmt/binding-linux-arm-musleabihf@0.
|
|
54
|
+
"@oxfmt/binding-linux-arm-musleabihf": ["@oxfmt/binding-linux-arm-musleabihf@0.67.0", "", { "os": "linux", "cpu": "arm" }, "sha512-wPIeeigXgJpwNw3wydYRt3U9iN9Y/ejpOZuYL9IA7igxWs7LIQMOkhKxTumRvy6dIv0iXKk3RTw3Vmjg0i+2sg=="],
|
|
55
55
|
|
|
56
|
-
"@oxfmt/binding-linux-arm64-gnu": ["@oxfmt/binding-linux-arm64-gnu@0.
|
|
56
|
+
"@oxfmt/binding-linux-arm64-gnu": ["@oxfmt/binding-linux-arm64-gnu@0.67.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-0+XNxcdbkTfxdcD4qW6Ci9n+mBNJ8xTBumnxKvKBmRFOdx0Wf8/KiHjCJayooXmYkqRpRVd98Q5egvzx5BLSgQ=="],
|
|
57
57
|
|
|
58
|
-
"@oxfmt/binding-linux-arm64-musl": ["@oxfmt/binding-linux-arm64-musl@0.
|
|
58
|
+
"@oxfmt/binding-linux-arm64-musl": ["@oxfmt/binding-linux-arm64-musl@0.67.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-I75LKPJyNOYUzkqAiAMIE31+Ye7xtQXZdoty1IXn4B+bw5Zpmez5wfG19ejGpNnS/BzQ7LFS+7jxuTPb+vHiZw=="],
|
|
59
59
|
|
|
60
|
-
"@oxfmt/binding-linux-ppc64-gnu": ["@oxfmt/binding-linux-ppc64-gnu@0.
|
|
60
|
+
"@oxfmt/binding-linux-ppc64-gnu": ["@oxfmt/binding-linux-ppc64-gnu@0.67.0", "", { "os": "linux", "cpu": "ppc64" }, "sha512-c2M5iRpe1QMZSRE/UvZoPdXBWb5Ic/ycvOyNiKCqPwQ/OyOKIMiJs02ynlNnjb7ZZJnRXYLmGcohoINOcwDK3w=="],
|
|
61
61
|
|
|
62
|
-
"@oxfmt/binding-linux-riscv64-gnu": ["@oxfmt/binding-linux-riscv64-gnu@0.
|
|
62
|
+
"@oxfmt/binding-linux-riscv64-gnu": ["@oxfmt/binding-linux-riscv64-gnu@0.67.0", "", { "os": "linux", "cpu": "none" }, "sha512-dQzzYlV24Udhfm5ECuSdgqRvFJU/CGHzcYYEO3dLM6W6+CHiBFrq9OjIllkdCcPhsoSQ8o223Dja84MOSzed9A=="],
|
|
63
63
|
|
|
64
|
-
"@oxfmt/binding-linux-riscv64-musl": ["@oxfmt/binding-linux-riscv64-musl@0.
|
|
64
|
+
"@oxfmt/binding-linux-riscv64-musl": ["@oxfmt/binding-linux-riscv64-musl@0.67.0", "", { "os": "linux", "cpu": "none" }, "sha512-rFNq1CgX4qMJANOq42LkAs90JE80GpiaEohAV2qn/gT2hGjQTW1zBO5zQBxArI4926pM1OSzo3CN0tBszGBIaA=="],
|
|
65
65
|
|
|
66
|
-
"@oxfmt/binding-linux-s390x-gnu": ["@oxfmt/binding-linux-s390x-gnu@0.
|
|
66
|
+
"@oxfmt/binding-linux-s390x-gnu": ["@oxfmt/binding-linux-s390x-gnu@0.67.0", "", { "os": "linux", "cpu": "s390x" }, "sha512-Sky6rEdz2o5IGq01lPhS12yEvDdChVEcaYrcLHkveh4Fx0qPjljE/Iul6SX/bRMl6lNc8J7J/mDQdzgBdA++Pg=="],
|
|
67
67
|
|
|
68
|
-
"@oxfmt/binding-linux-x64-gnu": ["@oxfmt/binding-linux-x64-gnu@0.
|
|
68
|
+
"@oxfmt/binding-linux-x64-gnu": ["@oxfmt/binding-linux-x64-gnu@0.67.0", "", { "os": "linux", "cpu": "x64" }, "sha512-vPXmlNORV8AZq2Ocxh07pxwMjfENUWCV/eZArnao0qC3NO/hDeTVkQvee7SJJUbIiF5PZbBa4kYmaXnu7Rk58w=="],
|
|
69
69
|
|
|
70
|
-
"@oxfmt/binding-linux-x64-musl": ["@oxfmt/binding-linux-x64-musl@0.
|
|
70
|
+
"@oxfmt/binding-linux-x64-musl": ["@oxfmt/binding-linux-x64-musl@0.67.0", "", { "os": "linux", "cpu": "x64" }, "sha512-x/WAtFqYtVr3vZ9ni8nr4kn9whSitg8fOljq/pZzBpxopRdY1BMLZCZkrbIbaBcYkm46qGbqVea2FCWmtQ2P9w=="],
|
|
71
71
|
|
|
72
|
-
"@oxfmt/binding-openharmony-arm64": ["@oxfmt/binding-openharmony-arm64@0.
|
|
72
|
+
"@oxfmt/binding-openharmony-arm64": ["@oxfmt/binding-openharmony-arm64@0.67.0", "", { "os": "none", "cpu": "arm64" }, "sha512-eRw9Neh4/aA6i+q/R3WU1gGQINhVM0J4fXIm6t27caOamkr/37uAkp1IdBx4zlJH97hmXR63z/q9n5c5dN7MzA=="],
|
|
73
73
|
|
|
74
|
-
"@oxfmt/binding-win32-arm64-msvc": ["@oxfmt/binding-win32-arm64-msvc@0.
|
|
74
|
+
"@oxfmt/binding-win32-arm64-msvc": ["@oxfmt/binding-win32-arm64-msvc@0.67.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-YIMvb+sGNYN2uc6+QK2HLPeEKM2vl7QZ5onQzpAJRb6pnf0DwUFP5R8tdS9R0l8hdUil2gu4Uxd0Yxrop0iT4w=="],
|
|
75
75
|
|
|
76
|
-
"@oxfmt/binding-win32-ia32-msvc": ["@oxfmt/binding-win32-ia32-msvc@0.
|
|
76
|
+
"@oxfmt/binding-win32-ia32-msvc": ["@oxfmt/binding-win32-ia32-msvc@0.67.0", "", { "os": "win32", "cpu": "ia32" }, "sha512-LzmU9MyACPzwNDIK0ItMedHPz735Ug7ELWguxo4/kuy6zWuDoeglOAEFCY8jLg0PzRpFO3hDyLFe2Gu2eFDeGA=="],
|
|
77
77
|
|
|
78
|
-
"@oxfmt/binding-win32-x64-msvc": ["@oxfmt/binding-win32-x64-msvc@0.
|
|
78
|
+
"@oxfmt/binding-win32-x64-msvc": ["@oxfmt/binding-win32-x64-msvc@0.67.0", "", { "os": "win32", "cpu": "x64" }, "sha512-sbQOIDNLUEeVZcAJcSL5VURn7kfjvilPviody4Yl5n8lQCDtUm+C9oHTTwZS/m4d/Z6Vv3jNEiAofH932NPPCg=="],
|
|
79
79
|
|
|
80
|
-
"@oxlint/binding-android-arm-eabi": ["@oxlint/binding-android-arm-eabi@1.
|
|
80
|
+
"@oxlint/binding-android-arm-eabi": ["@oxlint/binding-android-arm-eabi@1.82.0", "", { "os": "android", "cpu": "arm" }, "sha512-a3LB+C5Dsj5b/qtmG/mv5WrzuiXEpg1KF5nXWcEvaoN5TYAqkIvxPOwTPp3Jy/FoGpRo8zsTFhMElMXfeoOEzA=="],
|
|
81
81
|
|
|
82
|
-
"@oxlint/binding-android-arm64": ["@oxlint/binding-android-arm64@1.
|
|
82
|
+
"@oxlint/binding-android-arm64": ["@oxlint/binding-android-arm64@1.82.0", "", { "os": "android", "cpu": "arm64" }, "sha512-OBlhRgNqFblGpGenno/aqOfJLOkQ2B8Ig3iDAalfn0H8hJGZKXPeexCRTDm6uwv6YUjSA9Xnwt1y/Bgj5ZH8uw=="],
|
|
83
83
|
|
|
84
|
-
"@oxlint/binding-darwin-arm64": ["@oxlint/binding-darwin-arm64@1.
|
|
84
|
+
"@oxlint/binding-darwin-arm64": ["@oxlint/binding-darwin-arm64@1.82.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-dsopxqtY5ZdyT9uLHyGt1SyiLop6hi7hWI3PKpePodkRQOkLaCm+OE4fR9CAz9qdfjiFO8531tX/QDyP/psjFg=="],
|
|
85
85
|
|
|
86
|
-
"@oxlint/binding-darwin-x64": ["@oxlint/binding-darwin-x64@1.
|
|
86
|
+
"@oxlint/binding-darwin-x64": ["@oxlint/binding-darwin-x64@1.82.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-94Lu0SgTClKColU66g1VDuigV3HkcbkJBnTtZjGYfE8UPugaWDgKrm2icjC6HJVUYler2OXaHP/X0TBy8+CowQ=="],
|
|
87
87
|
|
|
88
|
-
"@oxlint/binding-freebsd-x64": ["@oxlint/binding-freebsd-x64@1.
|
|
88
|
+
"@oxlint/binding-freebsd-x64": ["@oxlint/binding-freebsd-x64@1.82.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-hne/V06ewhh1i0w8+l7GDNROAGCGPmyFuOwiP7YTRu0JycyStJ4785dmF8xU5p0uUwt2emvIF9vc7Xjis+cJ0g=="],
|
|
89
89
|
|
|
90
|
-
"@oxlint/binding-linux-arm-gnueabihf": ["@oxlint/binding-linux-arm-gnueabihf@1.
|
|
90
|
+
"@oxlint/binding-linux-arm-gnueabihf": ["@oxlint/binding-linux-arm-gnueabihf@1.82.0", "", { "os": "linux", "cpu": "arm" }, "sha512-aWY2xtbZf1LneW9Qsv/n2Sp8gOu74JrlQzEtj4coHX2SHFrCfhmAumaU+sI/A5nr+yoTRTSmI/pL2s6ADlNSkw=="],
|
|
91
91
|
|
|
92
|
-
"@oxlint/binding-linux-arm-musleabihf": ["@oxlint/binding-linux-arm-musleabihf@1.
|
|
92
|
+
"@oxlint/binding-linux-arm-musleabihf": ["@oxlint/binding-linux-arm-musleabihf@1.82.0", "", { "os": "linux", "cpu": "arm" }, "sha512-Fe+TtXCXMh/5f7kWlZ2VAwsMumZWtraFlKVk1NJlL52/beGwfDE7ov+/8gVirHzWokzGu7X65hSPq0ucPDskWQ=="],
|
|
93
93
|
|
|
94
|
-
"@oxlint/binding-linux-arm64-gnu": ["@oxlint/binding-linux-arm64-gnu@1.
|
|
94
|
+
"@oxlint/binding-linux-arm64-gnu": ["@oxlint/binding-linux-arm64-gnu@1.82.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-6azCZ6OJudlvipNttXCCQcyeFfcJ/NvUZdSN1z8elo73kCHtyQC7WTiUcSjWYvJ1jaq9KDUyMAoAS/vNzhBomA=="],
|
|
95
95
|
|
|
96
|
-
"@oxlint/binding-linux-arm64-musl": ["@oxlint/binding-linux-arm64-musl@1.
|
|
96
|
+
"@oxlint/binding-linux-arm64-musl": ["@oxlint/binding-linux-arm64-musl@1.82.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-PLEaSD8IAIIlwW4dwOd9YaxuxeOpwiXL4J24rcnE4iNtyM5j9Q9/3+gti08oXpx0u2ygNjRDx9xjWWpQonuJEw=="],
|
|
97
97
|
|
|
98
|
-
"@oxlint/binding-linux-ppc64-gnu": ["@oxlint/binding-linux-ppc64-gnu@1.
|
|
98
|
+
"@oxlint/binding-linux-ppc64-gnu": ["@oxlint/binding-linux-ppc64-gnu@1.82.0", "", { "os": "linux", "cpu": "ppc64" }, "sha512-D94em/BwknNTn4vqxjHh5wb2oL566eFhArabqKIr0cNZMHOJuiraFp1A8tXpH05bbE5tqwEfLXTI0MWEGtn3Dw=="],
|
|
99
99
|
|
|
100
|
-
"@oxlint/binding-linux-riscv64-gnu": ["@oxlint/binding-linux-riscv64-gnu@1.
|
|
100
|
+
"@oxlint/binding-linux-riscv64-gnu": ["@oxlint/binding-linux-riscv64-gnu@1.82.0", "", { "os": "linux", "cpu": "none" }, "sha512-MOprxBaoYU2D4VgxXCl3ghydThWtx7Um1lL51kGYNeQ5Al7WzsH7/tqGdNtbLrIWnjq3bsm13+nz/gRIxjrOXw=="],
|
|
101
101
|
|
|
102
|
-
"@oxlint/binding-linux-riscv64-musl": ["@oxlint/binding-linux-riscv64-musl@1.
|
|
102
|
+
"@oxlint/binding-linux-riscv64-musl": ["@oxlint/binding-linux-riscv64-musl@1.82.0", "", { "os": "linux", "cpu": "none" }, "sha512-5h55QsfJ/luDXZzC20k6SNOY1Az+dCP9WvntKtcUWh2JhckAdwApY2ZusaBTwLENnReXU+A2fJtSrYvZJNKNPg=="],
|
|
103
103
|
|
|
104
|
-
"@oxlint/binding-linux-s390x-gnu": ["@oxlint/binding-linux-s390x-gnu@1.
|
|
104
|
+
"@oxlint/binding-linux-s390x-gnu": ["@oxlint/binding-linux-s390x-gnu@1.82.0", "", { "os": "linux", "cpu": "s390x" }, "sha512-IE8NJNLlHr0CaXyGJPGVn0eTkUyoj1I2UfA8x7I4PSOYKsQ/6btVC7Pywrj5onk0cMH25r6Z38SoN3AvE5Zuog=="],
|
|
105
105
|
|
|
106
|
-
"@oxlint/binding-linux-x64-gnu": ["@oxlint/binding-linux-x64-gnu@1.
|
|
106
|
+
"@oxlint/binding-linux-x64-gnu": ["@oxlint/binding-linux-x64-gnu@1.82.0", "", { "os": "linux", "cpu": "x64" }, "sha512-XUUUxaBo9XKl+J1B9EmP1cTGQPddzeURvoGkfwh/94PGnbW+hBprDljneoI2M1jzC1bzrIV3ihc7iM9UXl8+tg=="],
|
|
107
107
|
|
|
108
|
-
"@oxlint/binding-linux-x64-musl": ["@oxlint/binding-linux-x64-musl@1.
|
|
108
|
+
"@oxlint/binding-linux-x64-musl": ["@oxlint/binding-linux-x64-musl@1.82.0", "", { "os": "linux", "cpu": "x64" }, "sha512-SWLSFulX9TDuH6yvbPYp4+VNn6jkkIvvI+KiujDM5rWBRHEfkesCC/pCneIIUr6ovkxZ5fRtpi2v5Cz5FrMJZg=="],
|
|
109
109
|
|
|
110
|
-
"@oxlint/binding-openharmony-arm64": ["@oxlint/binding-openharmony-arm64@1.
|
|
110
|
+
"@oxlint/binding-openharmony-arm64": ["@oxlint/binding-openharmony-arm64@1.82.0", "", { "os": "none", "cpu": "arm64" }, "sha512-BQy35f6ZUdNr9a6c7B7orxQTcLjByGT2z3WAgmRovpRwmPYAaJ+NTplmMzhdjdJ4qSchfMNZy/Ukg+qRg6zseQ=="],
|
|
111
111
|
|
|
112
|
-
"@oxlint/binding-win32-arm64-msvc": ["@oxlint/binding-win32-arm64-msvc@1.
|
|
112
|
+
"@oxlint/binding-win32-arm64-msvc": ["@oxlint/binding-win32-arm64-msvc@1.82.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-V4QhSTg5gctZue8RJjsGi7NpQPThr/p1/HfmiMC5kfe1KFEup9SQRVub4A6kijQjdHfxj7bLL1KO3QO7/5bwMQ=="],
|
|
113
113
|
|
|
114
|
-
"@oxlint/binding-win32-ia32-msvc": ["@oxlint/binding-win32-ia32-msvc@1.
|
|
114
|
+
"@oxlint/binding-win32-ia32-msvc": ["@oxlint/binding-win32-ia32-msvc@1.82.0", "", { "os": "win32", "cpu": "ia32" }, "sha512-TUSCLaKB2yktpFAJ/r3HAUYsaV/3DT7JS4iNKyoh3a9YNwD0UG7Ezh4D8m23654vQcU6P/RQrCAjRPKe4peP/A=="],
|
|
115
115
|
|
|
116
|
-
"@oxlint/binding-win32-x64-msvc": ["@oxlint/binding-win32-x64-msvc@1.
|
|
116
|
+
"@oxlint/binding-win32-x64-msvc": ["@oxlint/binding-win32-x64-msvc@1.82.0", "", { "os": "win32", "cpu": "x64" }, "sha512-VTVoRIWJTb+wvUX8EYoPArfFH02whuR10goFXE/LHRRX33ajRrFgqbcONXZMiF4C5rnattfkm87HqYn8jb8hmQ=="],
|
|
117
117
|
|
|
118
|
-
"@types/bun": ["@types/bun@1.4.
|
|
118
|
+
"@types/bun": ["@types/bun@1.4.2", "", { "dependencies": { "bun-types": "1.4.2" } }, "sha512-GimotNn7+ZV0uVArItBbriZsR1oNf0+WTzPkdcFrzShI7k2norL0uzEaJT8T33dWr7O/c9ZDuAFQrctKCi72oQ=="],
|
|
119
119
|
|
|
120
120
|
"@types/hast": ["@types/hast@3.0.5", "", { "dependencies": { "@types/unist": "*" } }, "sha512-rp/ezSWaD1m44dPKICGhiskI13nVr7qTloFwDa/IYkhhf5nzwP+zIQcIJh3WIFSBOy/H1PzB40jPjMDksN4F+g=="],
|
|
121
121
|
|
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
|
|
164
164
|
"@typescript/typescript-win32-x64": ["@typescript/typescript-win32-x64@7.0.2", "", { "os": "win32", "cpu": "x64" }, "sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g=="],
|
|
165
165
|
|
|
166
|
-
"bun-types": ["bun-types@1.4.
|
|
166
|
+
"bun-types": ["bun-types@1.4.2", "", { "dependencies": { "@types/node": "*" } }, "sha512-bxV1FgK7yBIzjRe5zBozIM4Bem11ZJcCXSrjWRG3YWLt8yFDePu4cLjpebO8OvPeIE9trbyPF4fuj3Cia4Fj3w=="],
|
|
167
167
|
|
|
168
168
|
"chalk": ["chalk@5.6.2", "", {}, "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA=="],
|
|
169
169
|
|
|
@@ -183,9 +183,9 @@
|
|
|
183
183
|
|
|
184
184
|
"lowlight": ["lowlight@3.1.0", "", { "dependencies": { "@types/hast": "^3.0.0", "devlop": "^1.0.0", "highlight.js": "~11.9.0" } }, "sha512-CEbNVoSikAxwDMDPjXlqlFYiZLkDJHwyGu/MfOsJnF3d7f3tds5J3z8s/l9TMXhzfsJCCJEAsD78842mwmg0PQ=="],
|
|
185
185
|
|
|
186
|
-
"oxfmt": ["oxfmt@0.
|
|
186
|
+
"oxfmt": ["oxfmt@0.67.0", "", { "dependencies": { "tinypool": "2.1.2" }, "optionalDependencies": { "@oxfmt/binding-android-arm-eabi": "0.67.0", "@oxfmt/binding-android-arm64": "0.67.0", "@oxfmt/binding-darwin-arm64": "0.67.0", "@oxfmt/binding-darwin-x64": "0.67.0", "@oxfmt/binding-freebsd-x64": "0.67.0", "@oxfmt/binding-linux-arm-gnueabihf": "0.67.0", "@oxfmt/binding-linux-arm-musleabihf": "0.67.0", "@oxfmt/binding-linux-arm64-gnu": "0.67.0", "@oxfmt/binding-linux-arm64-musl": "0.67.0", "@oxfmt/binding-linux-ppc64-gnu": "0.67.0", "@oxfmt/binding-linux-riscv64-gnu": "0.67.0", "@oxfmt/binding-linux-riscv64-musl": "0.67.0", "@oxfmt/binding-linux-s390x-gnu": "0.67.0", "@oxfmt/binding-linux-x64-gnu": "0.67.0", "@oxfmt/binding-linux-x64-musl": "0.67.0", "@oxfmt/binding-openharmony-arm64": "0.67.0", "@oxfmt/binding-win32-arm64-msvc": "0.67.0", "@oxfmt/binding-win32-ia32-msvc": "0.67.0", "@oxfmt/binding-win32-x64-msvc": "0.67.0" }, "peerDependencies": { "svelte": "^5.0.0", "vite-plus": "*" }, "optionalPeers": ["svelte", "vite-plus"], "bin": { "oxfmt": "bin/oxfmt" } }, "sha512-vV7sSiPsaO0mSxdoUdayipVDFPzW/UQ+hrezEHa20+Tx1dnMdZLSRHMT0PdS67FFbhd74M1n08asW21aLGeCrA=="],
|
|
187
187
|
|
|
188
|
-
"oxlint": ["oxlint@1.
|
|
188
|
+
"oxlint": ["oxlint@1.82.0", "", { "optionalDependencies": { "@oxlint/binding-android-arm-eabi": "1.82.0", "@oxlint/binding-android-arm64": "1.82.0", "@oxlint/binding-darwin-arm64": "1.82.0", "@oxlint/binding-darwin-x64": "1.82.0", "@oxlint/binding-freebsd-x64": "1.82.0", "@oxlint/binding-linux-arm-gnueabihf": "1.82.0", "@oxlint/binding-linux-arm-musleabihf": "1.82.0", "@oxlint/binding-linux-arm64-gnu": "1.82.0", "@oxlint/binding-linux-arm64-musl": "1.82.0", "@oxlint/binding-linux-ppc64-gnu": "1.82.0", "@oxlint/binding-linux-riscv64-gnu": "1.82.0", "@oxlint/binding-linux-riscv64-musl": "1.82.0", "@oxlint/binding-linux-s390x-gnu": "1.82.0", "@oxlint/binding-linux-x64-gnu": "1.82.0", "@oxlint/binding-linux-x64-musl": "1.82.0", "@oxlint/binding-openharmony-arm64": "1.82.0", "@oxlint/binding-win32-arm64-msvc": "1.82.0", "@oxlint/binding-win32-ia32-msvc": "1.82.0", "@oxlint/binding-win32-x64-msvc": "1.82.0" }, "peerDependencies": { "oxlint-tsgolint": ">=7.0.2001", "vite-plus": "*" }, "optionalPeers": ["oxlint-tsgolint", "vite-plus"], "bin": { "oxlint": "bin/oxlint" } }, "sha512-+iFM1BGw1ntYJt3QngbJmjbrGxPaKMUADOXOijpWGnYcBPq8YZnQftSS1C+pVcDYy9YxqDVJKQqQkTazTQMboQ=="],
|
|
189
189
|
|
|
190
190
|
"prettier": ["prettier@3.9.6", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-OpN0zzVdiaiAhxpuuj5efpIS4sY9j7bY6uR5mnj5yPzGkdkjNKSJeUThPb60Jw29QuAZgA4o+/iB49kFiaBX6g=="],
|
|
191
191
|
|
|
@@ -195,13 +195,13 @@
|
|
|
195
195
|
|
|
196
196
|
"supports-terminal-graphics": ["supports-terminal-graphics@0.1.0", "", {}, "sha512-+KdfozhS0Fw8y5Sghw8kkZNGT8nWYzJ1EzcoIvVjxhl+26TJTs26y02yfBgvc1jh5AS/c8jcI3xtahhR95KRyQ=="],
|
|
197
197
|
|
|
198
|
-
"tinypool": ["tinypool@2.1.
|
|
198
|
+
"tinypool": ["tinypool@2.1.2", "", {}, "sha512-9YodfrxS9g9IbFr/KOjE5bAeJ0p61n3bW6mqvy0jtoeKd1kTW1Cxm0oulm6KX2lyM9Gl6WIe8nEbY7LWv5ZJww=="],
|
|
199
199
|
|
|
200
200
|
"typescript": ["typescript@7.0.2", "", { "optionalDependencies": { "@typescript/typescript-aix-ppc64": "7.0.2", "@typescript/typescript-darwin-arm64": "7.0.2", "@typescript/typescript-darwin-x64": "7.0.2", "@typescript/typescript-freebsd-arm64": "7.0.2", "@typescript/typescript-freebsd-x64": "7.0.2", "@typescript/typescript-linux-arm": "7.0.2", "@typescript/typescript-linux-arm64": "7.0.2", "@typescript/typescript-linux-loong64": "7.0.2", "@typescript/typescript-linux-mips64el": "7.0.2", "@typescript/typescript-linux-ppc64": "7.0.2", "@typescript/typescript-linux-riscv64": "7.0.2", "@typescript/typescript-linux-s390x": "7.0.2", "@typescript/typescript-linux-x64": "7.0.2", "@typescript/typescript-netbsd-arm64": "7.0.2", "@typescript/typescript-netbsd-x64": "7.0.2", "@typescript/typescript-openbsd-arm64": "7.0.2", "@typescript/typescript-openbsd-x64": "7.0.2", "@typescript/typescript-sunos-x64": "7.0.2", "@typescript/typescript-win32-arm64": "7.0.2", "@typescript/typescript-win32-x64": "7.0.2" }, "bin": { "tsc": "bin/tsc" } }, "sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA=="],
|
|
201
201
|
|
|
202
202
|
"undici-types": ["undici-types@8.3.0", "", {}, "sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ=="],
|
|
203
203
|
|
|
204
|
-
"zod": ["zod@4.
|
|
204
|
+
"zod": ["zod@4.6.1", "", {}, "sha512-341aRWQsve0rvronKNTqZpjmzdbUDlFuzHaI/XLg/Ej82qffDJRRfBTCuv7+9q/rMjB6LSLyEBnW4InJeMtt/Q=="],
|
|
205
205
|
|
|
206
206
|
"zod-to-json-schema": ["zod-to-json-schema@3.25.2", "", { "peerDependencies": { "zod": "^3.25.28 || ^4" } }, "sha512-O/PgfnpT1xKSDeQYSCfRI5Gy3hPf91mKVDuYLUHZJMiDFptvP41MSnWofm8dnCm0256ZNfZIM7DSzuSMAFnjHA=="],
|
|
207
207
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowscripter/flowscripter-io-cli",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "Example CLI using https://github.com/flowscripter/pluggable-io-framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bun",
|
|
@@ -21,19 +21,19 @@
|
|
|
21
21
|
"access": "public"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@flowscripter/dynamic-cli-framework": "^5.4.
|
|
24
|
+
"@flowscripter/dynamic-cli-framework": "^5.4.8",
|
|
25
25
|
"@flowscripter/dynamic-cli-framework-api": "^2.3.4",
|
|
26
|
-
"@flowscripter/dynamic-plugin-framework": "^2.2.
|
|
27
|
-
"@flowscripter/flowscripter-io-cli-hash-native": "^1.0.
|
|
28
|
-
"@flowscripter/pluggable-io-framework": "^1.1.
|
|
29
|
-
"@flowscripter/pluggable-io-framework-api": "^1.0.
|
|
26
|
+
"@flowscripter/dynamic-plugin-framework": "^2.2.6",
|
|
27
|
+
"@flowscripter/flowscripter-io-cli-hash-native": "^1.0.3",
|
|
28
|
+
"@flowscripter/pluggable-io-framework": "^1.1.5",
|
|
29
|
+
"@flowscripter/pluggable-io-framework-api": "^1.0.9"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@flowscripter/io-plugin-filesystem": "^1.0.
|
|
33
|
-
"@types/bun": "^1.4.
|
|
32
|
+
"@flowscripter/io-plugin-filesystem": "^1.0.6",
|
|
33
|
+
"@types/bun": "^1.4.2",
|
|
34
34
|
"@types/node": "^26.4.1",
|
|
35
|
-
"oxfmt": "0.
|
|
36
|
-
"oxlint": "1.
|
|
35
|
+
"oxfmt": "0.67.0",
|
|
36
|
+
"oxlint": "1.82.0"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"typescript": "^7.0.2"
|
package/src/byteScale.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const BYTE_UNITS: ReadonlyArray<{ unit: string; divisor: number }> = [
|
|
2
|
+
{ unit: "GB", divisor: 1024 ** 3 },
|
|
3
|
+
{ unit: "MB", divisor: 1024 ** 2 },
|
|
4
|
+
{ unit: "KB", divisor: 1024 },
|
|
5
|
+
{ unit: "bytes", divisor: 1 },
|
|
6
|
+
];
|
|
7
|
+
|
|
8
|
+
/** Picks the largest unit that keeps `totalBytes` at 1 or more, so the scaled total isn't < 1. */
|
|
9
|
+
export function pickByteUnit(totalBytes: number): { unit: string; divisor: number } {
|
|
10
|
+
return (
|
|
11
|
+
BYTE_UNITS.find(({ divisor }) => totalBytes >= divisor) ?? BYTE_UNITS[BYTE_UNITS.length - 1]!
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface ByteScale {
|
|
16
|
+
readonly unit: string;
|
|
17
|
+
readonly total: number;
|
|
18
|
+
scale(bytes: number): number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Scales byte counts against a fixed total into the largest sensible unit (bytes/KB/MB/GB). */
|
|
22
|
+
export function createByteScale(totalBytes: number): ByteScale {
|
|
23
|
+
const { unit, divisor } = pickByteUnit(totalBytes);
|
|
24
|
+
const scale = (bytes: number): number => Math.round((bytes / divisor) * 100) / 100;
|
|
25
|
+
return { unit, total: scale(totalBytes), scale };
|
|
26
|
+
}
|
package/src/commands/copy.ts
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
} from "@flowscripter/dynamic-cli-framework";
|
|
9
9
|
import { copy as copyProvider } from "@flowscripter/pluggable-io-framework";
|
|
10
10
|
import { getFilesystemProvider } from "../filesystemProvider.ts";
|
|
11
|
+
import { createByteScale } from "../byteScale.ts";
|
|
11
12
|
|
|
12
13
|
const copy: SubCommand = {
|
|
13
14
|
name: "copy",
|
|
@@ -33,16 +34,17 @@ const copy: SubCommand = {
|
|
|
33
34
|
const provider = await getFilesystemProvider("");
|
|
34
35
|
try {
|
|
35
36
|
const { size } = await provider.getProperties(source);
|
|
37
|
+
const byteScale = createByteScale(size ?? 100);
|
|
36
38
|
const handle = await printerService.showProgressBar(
|
|
37
|
-
|
|
39
|
+
byteScale.unit,
|
|
38
40
|
`Copying ${source}`,
|
|
39
|
-
|
|
41
|
+
byteScale.total,
|
|
40
42
|
);
|
|
41
43
|
try {
|
|
42
44
|
await copyProvider(provider, source, provider, destination, {
|
|
43
45
|
telemetry: {
|
|
44
46
|
onProgress: (event) => {
|
|
45
|
-
printerService.updateProgressBar(handle, event.bytesProcessed);
|
|
47
|
+
printerService.updateProgressBar(handle, byteScale.scale(event.bytesProcessed));
|
|
46
48
|
},
|
|
47
49
|
},
|
|
48
50
|
});
|
package/src/commands/hash.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
import { ChunkKind, type ChunkRef } from "@flowscripter/pluggable-io-framework-api";
|
|
10
10
|
import { Sha256Hasher } from "@flowscripter/flowscripter-io-cli-hash-native";
|
|
11
11
|
import { getFilesystemProvider } from "../filesystemProvider.ts";
|
|
12
|
+
import { createByteScale } from "../byteScale.ts";
|
|
12
13
|
|
|
13
14
|
const hash: SubCommand = {
|
|
14
15
|
name: "hash",
|
|
@@ -38,15 +39,16 @@ const hash: SubCommand = {
|
|
|
38
39
|
const provider = await getFilesystemProvider("");
|
|
39
40
|
try {
|
|
40
41
|
const { size } = await provider.getProperties(path);
|
|
42
|
+
const byteScale = createByteScale(size ?? 100);
|
|
41
43
|
const progressHandle = await printerService.showProgressBar(
|
|
42
|
-
|
|
44
|
+
byteScale.unit,
|
|
43
45
|
`Hashing ${path}`,
|
|
44
|
-
|
|
46
|
+
byteScale.total,
|
|
45
47
|
);
|
|
46
48
|
let bytesProcessed = 0;
|
|
47
49
|
const onChunk = (chunkLength: number): void => {
|
|
48
50
|
bytesProcessed += chunkLength;
|
|
49
|
-
printerService.updateProgressBar(progressHandle, bytesProcessed);
|
|
51
|
+
printerService.updateProgressBar(progressHandle, byteScale.scale(bytesProcessed));
|
|
50
52
|
};
|
|
51
53
|
try {
|
|
52
54
|
const handle = await provider.getReadableStream(path);
|
package/src/commands/move.ts
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
} from "@flowscripter/dynamic-cli-framework";
|
|
9
9
|
import { move as moveProvider } from "@flowscripter/pluggable-io-framework";
|
|
10
10
|
import { getFilesystemProvider } from "../filesystemProvider.ts";
|
|
11
|
+
import { createByteScale } from "../byteScale.ts";
|
|
11
12
|
|
|
12
13
|
const move: SubCommand = {
|
|
13
14
|
name: "move",
|
|
@@ -33,12 +34,17 @@ const move: SubCommand = {
|
|
|
33
34
|
const provider = await getFilesystemProvider("");
|
|
34
35
|
try {
|
|
35
36
|
const { size } = await provider.getProperties(source);
|
|
36
|
-
const
|
|
37
|
+
const byteScale = createByteScale(size ?? 100);
|
|
38
|
+
const handle = await printerService.showProgressBar(
|
|
39
|
+
byteScale.unit,
|
|
40
|
+
`Moving ${source}`,
|
|
41
|
+
byteScale.total,
|
|
42
|
+
);
|
|
37
43
|
try {
|
|
38
44
|
await moveProvider(provider, source, provider, destination, {
|
|
39
45
|
telemetry: {
|
|
40
46
|
onProgress: (event) => {
|
|
41
|
-
printerService.updateProgressBar(handle, event.bytesProcessed);
|
|
47
|
+
printerService.updateProgressBar(handle, byteScale.scale(event.bytesProcessed));
|
|
42
48
|
},
|
|
43
49
|
},
|
|
44
50
|
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { createByteScale, pickByteUnit } from "../src/byteScale.ts";
|
|
3
|
+
|
|
4
|
+
describe("pickByteUnit", () => {
|
|
5
|
+
test("scales to the largest unit that keeps the total at 1 or more", () => {
|
|
6
|
+
expect(pickByteUnit(500)).toEqual({ unit: "bytes", divisor: 1 });
|
|
7
|
+
expect(pickByteUnit(1024)).toEqual({ unit: "KB", divisor: 1024 });
|
|
8
|
+
expect(pickByteUnit(1024 ** 2)).toEqual({ unit: "MB", divisor: 1024 ** 2 });
|
|
9
|
+
expect(pickByteUnit(20_641_497_116)).toEqual({ unit: "GB", divisor: 1024 ** 3 });
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
describe("createByteScale", () => {
|
|
14
|
+
test("scales the total and subsequent values into the picked unit", () => {
|
|
15
|
+
const byteScale = createByteScale(20_641_497_116);
|
|
16
|
+
|
|
17
|
+
expect(byteScale.unit).toBe("GB");
|
|
18
|
+
expect(byteScale.total).toBeCloseTo(19.22, 2);
|
|
19
|
+
expect(byteScale.scale(13_817_151_488)).toBeCloseTo(12.87, 2);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test("keeps small totals in bytes", () => {
|
|
23
|
+
const byteScale = createByteScale(500);
|
|
24
|
+
|
|
25
|
+
expect(byteScale.unit).toBe("bytes");
|
|
26
|
+
expect(byteScale.total).toBe(500);
|
|
27
|
+
expect(byteScale.scale(250)).toBe(250);
|
|
28
|
+
});
|
|
29
|
+
});
|