@stryke/fs 0.1.6 → 0.1.8
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/README.md +3 -1
- package/dist/files/write-file.cjs +12 -15
- package/dist/files/write-file.mjs +3 -3
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
# Stryke - File System Utilities
|
|
5
5
|
|
|
6
6
|
A package containing various file system utilities that expand the functionality
|
|
7
|
-
of NodeJs
|
|
7
|
+
of NodeJs's `fs` module. This package is intended to be used instead of other
|
|
8
|
+
modern file system libraries such as `fs-extra` or `fs-jetpack` as it provides a
|
|
9
|
+
more modern and functional approach to working with the file system.
|
|
8
10
|
|
|
9
11
|
<!-- START doctoc -->
|
|
10
12
|
<!-- END doctoc -->
|
|
@@ -9,26 +9,23 @@ exports.writeJsonFileSync = writeJsonFileSync;
|
|
|
9
9
|
var _stormJson = require("@stryke/json/storm-json");
|
|
10
10
|
var _nodeFs = require("node:fs");
|
|
11
11
|
var _promises = require("node:fs/promises");
|
|
12
|
-
|
|
13
|
-
const writeFileSync = (e, t, o) => {
|
|
12
|
+
const writeFileSync = (e, o, n) => {
|
|
14
13
|
if (!e) throw new Error("No file path provided to write data");
|
|
15
|
-
(0, _nodeFs.writeFileSync)(e,
|
|
14
|
+
(0, _nodeFs.writeFileSync)(e, o ?? "", n);
|
|
16
15
|
},
|
|
17
|
-
writeFile = (e,
|
|
16
|
+
writeFile = (e, o, n) => {
|
|
18
17
|
if (!e) throw new Error("No file path provided to read data");
|
|
19
|
-
return (0, _promises.writeFile)(e,
|
|
18
|
+
return (0, _promises.writeFile)(e, o ?? "", n);
|
|
20
19
|
};
|
|
21
20
|
exports.writeFile = writeFile;
|
|
22
21
|
exports.writeFileSync = writeFileSync;
|
|
23
|
-
function writeJsonFileSync(e,
|
|
24
|
-
(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
` : n);
|
|
22
|
+
function writeJsonFileSync(e, o, n) {
|
|
23
|
+
const t = _stormJson.StormJSON.stringifyJson(o, n);
|
|
24
|
+
return writeFileSync(e, n?.appendNewLine ? `${t}
|
|
25
|
+
` : t);
|
|
28
26
|
}
|
|
29
|
-
async function writeJsonFile(e,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
` : n);
|
|
27
|
+
async function writeJsonFile(e, o, n) {
|
|
28
|
+
const t = _stormJson.StormJSON.stringifyJson(o, n);
|
|
29
|
+
return writeFile(e, n?.appendNewLine ? `${t}
|
|
30
|
+
` : t);
|
|
34
31
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{StormJSON as i}from"@stryke/json/storm-json";import{writeFileSync as r}from"node:fs";import{writeFile as s}from"node:fs/promises";
|
|
2
|
-
`:
|
|
3
|
-
`:
|
|
1
|
+
import{StormJSON as i}from"@stryke/json/storm-json";import{writeFileSync as r}from"node:fs";import{writeFile as s}from"node:fs/promises";export const writeFileSync=(e,o,n)=>{if(!e)throw new Error("No file path provided to write data");r(e,o??"",n)},writeFile=(e,o,n)=>{if(!e)throw new Error("No file path provided to read data");return s(e,o??"",n)};export function writeJsonFileSync(e,o,n){const t=i.stringifyJson(o,n);return writeFileSync(e,n?.appendNewLine?`${t}
|
|
2
|
+
`:t)}export async function writeJsonFile(e,o,n){const t=i.stringifyJson(o,n);return writeFile(e,n?.appendNewLine?`${t}
|
|
3
|
+
`:t)}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stryke/fs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing various file system utilities that expand the functionality of NodeJs's `fs` module.",
|
|
6
6
|
"repository": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"directory": "packages/fs"
|
|
10
10
|
},
|
|
11
11
|
"private": false,
|
|
12
|
-
"peerDependencies": { "nx": "^20.4.
|
|
12
|
+
"peerDependencies": { "nx": "^20.4.6" },
|
|
13
13
|
"peerDependenciesMeta": { "nx": { "optional": true } },
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@antfu/install-pkg": "^1.0.0",
|
|
@@ -17,13 +17,13 @@
|
|
|
17
17
|
"chalk": "^5.4.1",
|
|
18
18
|
"nanotar": "^0.2.0",
|
|
19
19
|
"semver": "7.7.1",
|
|
20
|
-
"@stryke/json": ">=0.1.
|
|
21
|
-
"@stryke/path": ">=0.1.
|
|
22
|
-
"@stryke/types": ">=0.1
|
|
20
|
+
"@stryke/json": ">=0.1.4",
|
|
21
|
+
"@stryke/path": ">=0.1.4",
|
|
22
|
+
"@stryke/types": ">=0.3.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/node": "^22.13.1",
|
|
26
|
-
"nx": "^20.4.
|
|
26
|
+
"nx": "^20.4.6",
|
|
27
27
|
"tinyexec": "^0.3.2"
|
|
28
28
|
},
|
|
29
29
|
"publishConfig": { "access": "public" },
|