@stacksjs/storage 0.74.37 → 0.74.38
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/zip.d.ts +20 -5
- package/dist/zip.js +1 -1
- package/package.json +10 -10
package/dist/zip.d.ts
CHANGED
|
@@ -1,12 +1,27 @@
|
|
|
1
1
|
import type { ZlibCompressionOptions } from 'bun';
|
|
2
2
|
import type { CommandError, Subprocess } from '@stacksjs/types';
|
|
3
3
|
import type { Result } from '@stacksjs/error-handling';
|
|
4
|
+
/*
|
|
5
|
+
* Arguments go as an ARRAY, never as a joined string.
|
|
6
|
+
*
|
|
7
|
+
* These used to build a shell command and single-quote each path with a
|
|
8
|
+
* `shellEscape` helper. `runCommand` spawns without a shell, so those quotes
|
|
9
|
+
* arrived as literal characters in the filename: `zip` looked for a file
|
|
10
|
+
* called `'uploads'`, quotes included, and answered `zip error: Nothing to
|
|
11
|
+
* do!` on a directory that was plainly not empty. Every one of these
|
|
12
|
+
* functions was therefore broken for every input it escaped - which is to say
|
|
13
|
+
* all of them - and nothing noticed, because they had no caller until
|
|
14
|
+
* `storage:backup` (stacksjs/stacks#269).
|
|
15
|
+
*
|
|
16
|
+
* The array form is what `exec` uses as argv directly, so a path with a space
|
|
17
|
+
* in it also works now, which the string form could never have managed.
|
|
18
|
+
*/
|
|
4
19
|
export declare function zip(from: string | string[], to?: string, options?: ZipOptions): Promise<Result<Subprocess, CommandError>>;
|
|
5
|
-
export declare function unzip(paths: string | string[]): Promise<Result<Subprocess, CommandError>>;
|
|
6
|
-
export declare function archive(paths: string | string[]): Promise<Result<Subprocess, CommandError>>;
|
|
7
|
-
export declare function unarchive(paths: string | string[]): Promise<Result<Subprocess, CommandError>>;
|
|
8
|
-
export declare function compress(paths: string[]): Promise<Result<Subprocess, CommandError>>;
|
|
9
|
-
export declare function decompress(paths: string | string[]): Promise<Result<Subprocess, CommandError>>;
|
|
20
|
+
export declare function unzip(paths: string | string[], options?: ZipOptions): Promise<Result<Subprocess, CommandError>>;
|
|
21
|
+
export declare function archive(paths: string | string[], to?: string, options?: ZipOptions): Promise<Result<Subprocess, CommandError>>;
|
|
22
|
+
export declare function unarchive(paths: string | string[], options?: ZipOptions): Promise<Result<Subprocess, CommandError>>;
|
|
23
|
+
export declare function compress(paths: string[], to?: string, options?: ZipOptions): Promise<Result<Subprocess, CommandError>>;
|
|
24
|
+
export declare function decompress(paths: string | string[], options?: ZipOptions): Promise<Result<Subprocess, CommandError>>;
|
|
10
25
|
/*
|
|
11
26
|
* Bun's zlib bindings take `Uint8Array<ArrayBuffer>` - a view over a real
|
|
12
27
|
* ArrayBuffer - while `Uint8Array` alone defaults to `ArrayBufferLike`, which
|
package/dist/zip.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{runCommand}from"@stacksjs/cli";
|
|
1
|
+
import{runCommand}from"@stacksjs/cli";export async function zip(from,to,options){const toPath=to||"archive.zip",sources=Array.isArray(from)?from:[from];return runCommand(["zip","-r",toPath,...sources],options)}export async function unzip(paths,options){const sources=Array.isArray(paths)?paths:[paths];return runCommand(["unzip","-o",...sources],options)}export function archive(paths,to,options){return zip(paths,to,options)}export function unarchive(paths,options){return unzip(paths,options)}export function compress(paths,to,options){return zip(paths,to,options)}export function decompress(paths,options){return unzip(paths,options)}export function gzipSync(data,options){return Bun.gzipSync(data,options)}export function gunzipSync(data){return Bun.gunzipSync(data)}export function deflateSync(data,options){return Bun.deflateSync(data,options)}export function inflateSync(data){return Bun.inflateSync(data)}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/storage",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.74.
|
|
5
|
+
"version": "0.74.38",
|
|
6
6
|
"description": "The Stacks file system.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -61,20 +61,20 @@
|
|
|
61
61
|
"prepublishOnly": "bun run build"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@stacksjs/arrays": "0.74.
|
|
65
|
-
"@stacksjs/cli": "0.74.
|
|
66
|
-
"@stacksjs/config": "0.74.
|
|
67
|
-
"@stacksjs/env": "0.74.
|
|
68
|
-
"@stacksjs/error-handling": "0.74.
|
|
69
|
-
"@stacksjs/logging": "0.74.
|
|
70
|
-
"@stacksjs/path": "0.74.
|
|
71
|
-
"@stacksjs/strings": "0.74.
|
|
64
|
+
"@stacksjs/arrays": "0.74.38",
|
|
65
|
+
"@stacksjs/cli": "0.74.38",
|
|
66
|
+
"@stacksjs/config": "0.74.38",
|
|
67
|
+
"@stacksjs/env": "0.74.38",
|
|
68
|
+
"@stacksjs/error-handling": "0.74.38",
|
|
69
|
+
"@stacksjs/logging": "0.74.38",
|
|
70
|
+
"@stacksjs/path": "0.74.38",
|
|
71
|
+
"@stacksjs/strings": "0.74.38",
|
|
72
72
|
"@stacksjs/ts-cloud": "^0.15.1",
|
|
73
73
|
"@stacksjs/ts-xml": "^0.1.0",
|
|
74
74
|
"ts-images": "^0.2.11"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"@stacksjs/types": "0.74.
|
|
77
|
+
"@stacksjs/types": "0.74.38",
|
|
78
78
|
"better-dx": "^0.2.24"
|
|
79
79
|
}
|
|
80
80
|
}
|