@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.
@@ -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
- try {
14
- if (!r) throw new Error("No file path provided to read data");
15
- return (0, _nodeFs.readFileSync)(r, {
16
- encoding: "utf8"
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
- try {
24
- if (!r) throw new Error("No file path provided to read data");
25
- return await (0, _promises.readFile)(r, {
26
- encoding: "utf8"
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;
@@ -1 +1 @@
1
- import{existsSync as e,readFileSync as t}from"node:fs";import{readFile as i}from"node:fs/promises";export const readFileSync=r=>{try{if(!r)throw new Error("No file path provided to read data");return t(r,{encoding:"utf8"})}catch{throw new Error("An error occurred writing data to file")}},readFile=async r=>{try{if(!r)throw new Error("No file path provided to read data");return await i(r,{encoding:"utf8"})}catch{throw new Error("An error occurred writing data to file")}};export function readFileIfExistingSync(r){return e(r)?readFileSync(r):""}export async function readFileIfExisting(r){return e(r)?readFile(r):""}
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.0",
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": "c60091277e3643e8619c90a06a9e9aed326359c1"
412
+ "gitHead": "e0563e4ee514ed73f3ab626d4d557a8c289eba26"
413
413
  }