@stryke/fs 0.32.0 → 0.32.1
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/read-file.cjs +8 -16
- package/dist/read-file.mjs +1 -1
- package/package.json +2 -2
package/dist/read-file.cjs
CHANGED
|
@@ -10,24 +10,16 @@ exports.readFileSync = void 0;
|
|
|
10
10
|
var _nodeFs = require("node:fs");
|
|
11
11
|
var _promises = require("node:fs/promises");
|
|
12
12
|
const readFileSync = r => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
});
|
|
18
|
-
} catch {
|
|
19
|
-
throw new Error("An error occurred writing data to file");
|
|
20
|
-
}
|
|
13
|
+
if (!r) throw new Error("No file path provided to read data");
|
|
14
|
+
return (0, _nodeFs.readFileSync)(r, {
|
|
15
|
+
encoding: "utf8"
|
|
16
|
+
});
|
|
21
17
|
},
|
|
22
18
|
readFile = async r => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
});
|
|
28
|
-
} catch {
|
|
29
|
-
throw new Error("An error occurred writing data to file");
|
|
30
|
-
}
|
|
19
|
+
if (!r) throw new Error("No file path provided to read data");
|
|
20
|
+
return (0, _promises.readFile)(r, {
|
|
21
|
+
encoding: "utf8"
|
|
22
|
+
});
|
|
31
23
|
};
|
|
32
24
|
exports.readFile = readFile;
|
|
33
25
|
exports.readFileSync = readFileSync;
|
package/dist/read-file.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as e,readFileSync as
|
|
1
|
+
import{existsSync as e,readFileSync as n}from"node:fs";import{readFile as i}from"node:fs/promises";export const readFileSync=r=>{if(!r)throw new Error("No file path provided to read data");return n(r,{encoding:"utf8"})},readFile=async r=>{if(!r)throw new Error("No file path provided to read data");return i(r,{encoding:"utf8"})};export function readFileIfExistingSync(r){return e(r)?readFileSync(r):""}export async function readFileIfExisting(r){return e(r)?readFile(r):""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stryke/fs",
|
|
3
|
-
"version": "0.32.
|
|
3
|
+
"version": "0.32.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing various file system utilities that expand the functionality of NodeJs's built-in `fs` module.",
|
|
6
6
|
"repository": {
|
|
@@ -409,5 +409,5 @@
|
|
|
409
409
|
"main": "./dist/index.cjs",
|
|
410
410
|
"module": "./dist/index.mjs",
|
|
411
411
|
"types": "./dist/index.d.ts",
|
|
412
|
-
"gitHead": "
|
|
412
|
+
"gitHead": "e0563e4ee514ed73f3ab626d4d557a8c289eba26"
|
|
413
413
|
}
|