@stacksjs/storage 0.59.5 → 0.59.7
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/index.js +6 -6
- package/dist/zip.d.ts +6 -6
- package/package.json +1 -1
- package/src/hash.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -17,9 +17,9 @@ import {contains} from "@stacksjs/arrays";
|
|
|
17
17
|
|
|
18
18
|
// src/fs.ts
|
|
19
19
|
import * as fs from "fs-extra";
|
|
20
|
-
import {pathExists as
|
|
20
|
+
import {pathExists as existsSync, mkdirSync, readFileSync, writeFileSync} from "fs-extra";
|
|
21
21
|
async function exists(path) {
|
|
22
|
-
return await
|
|
22
|
+
return await existsSync(path);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
// src/files.ts
|
|
@@ -37,7 +37,7 @@ async function readPackageJson(name, cwd) {
|
|
|
37
37
|
async function writeFile(path2, data) {
|
|
38
38
|
if (typeof path2 === "string") {
|
|
39
39
|
const dirPath = dirname(path2);
|
|
40
|
-
if (!await
|
|
40
|
+
if (!await existsSync(dirPath))
|
|
41
41
|
await createFolder(dirPath);
|
|
42
42
|
return await Bun.write(Bun.file(path2), data);
|
|
43
43
|
}
|
|
@@ -188,7 +188,7 @@ var folders = {
|
|
|
188
188
|
import {createHash} from "crypto";
|
|
189
189
|
import {path as p2} from "@stacksjs/path";
|
|
190
190
|
function hashFileOrDirectory(path4, hash) {
|
|
191
|
-
if (!existsSync(path4)) {
|
|
191
|
+
if (!fs.existsSync(path4)) {
|
|
192
192
|
console.error(`Path does not exist: ${path4}`);
|
|
193
193
|
return;
|
|
194
194
|
}
|
|
@@ -598,7 +598,7 @@ __export(exports_storage, {
|
|
|
598
598
|
},
|
|
599
599
|
existsSync: () => {
|
|
600
600
|
{
|
|
601
|
-
return
|
|
601
|
+
return existsSync;
|
|
602
602
|
}
|
|
603
603
|
},
|
|
604
604
|
exists: () => {
|
|
@@ -801,7 +801,7 @@ export {
|
|
|
801
801
|
fs,
|
|
802
802
|
folders,
|
|
803
803
|
files,
|
|
804
|
-
|
|
804
|
+
existsSync,
|
|
805
805
|
exists,
|
|
806
806
|
doesNotExist,
|
|
807
807
|
doesFolderExist,
|
package/dist/zip.d.ts
CHANGED
|
@@ -4,12 +4,12 @@ import type { ZlibCompressionOptions } from 'bun';
|
|
|
4
4
|
interface ZipOptions {
|
|
5
5
|
cwd?: string;
|
|
6
6
|
}
|
|
7
|
-
export declare function zip(from: string | string[], to?: string, options?: ZipOptions): Promise<
|
|
8
|
-
export declare function unzip(paths: string | string[]): Promise<
|
|
9
|
-
export declare function archive(paths: string | string[]): Promise<
|
|
10
|
-
export declare function unarchive(paths: string | string[]): Promise<
|
|
11
|
-
export declare function compress(paths: string[]): Promise<
|
|
12
|
-
export declare function decompress(paths: string | string[]): Promise<
|
|
7
|
+
export declare function zip(from: string | string[], to?: string, options?: ZipOptions): Promise<import("neverthrow").Result<Subprocess, CommandError>>;
|
|
8
|
+
export declare function unzip(paths: string | string[]): Promise<import("neverthrow").Result<Subprocess, CommandError>>;
|
|
9
|
+
export declare function archive(paths: string | string[]): Promise<import("neverthrow").Result<Subprocess, CommandError>>;
|
|
10
|
+
export declare function unarchive(paths: string | string[]): Promise<import("neverthrow").Result<Subprocess, CommandError>>;
|
|
11
|
+
export declare function compress(paths: string[]): Promise<import("neverthrow").Result<Subprocess, CommandError>>;
|
|
12
|
+
export declare function decompress(paths: string | string[]): Promise<import("neverthrow").Result<Subprocess, CommandError>>;
|
|
13
13
|
export declare function gzipSync(data: Uint8Array, options?: ZlibCompressionOptions): Uint8Array;
|
|
14
14
|
export declare function gunzipSync(data: Uint8Array): Uint8Array;
|
|
15
15
|
export declare function deflateSync(data: Uint8Array, options?: ZlibCompressionOptions): Uint8Array;
|
package/package.json
CHANGED
package/src/hash.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { fs } from './fs'
|
|
|
5
5
|
|
|
6
6
|
export function hashFileOrDirectory(path: string, hash: Hash): void {
|
|
7
7
|
// Check if the path exists before proceeding
|
|
8
|
-
if (!existsSync(path)) {
|
|
8
|
+
if (!fs.existsSync(path)) {
|
|
9
9
|
console.error(`Path does not exist: ${path}`)
|
|
10
10
|
// Handle the non-existent path as needed (e.g., skip or log)
|
|
11
11
|
return
|