@jsenv/filesystem 4.7.2 → 4.7.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/filesystem",
3
- "version": "4.7.2",
3
+ "version": "4.7.3",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -32,7 +32,7 @@
32
32
  "test": "node --conditions=development ./scripts/test.mjs"
33
33
  },
34
34
  "dependencies": {
35
- "@jsenv/urls": "2.2.7",
35
+ "@jsenv/urls": "2.2.8",
36
36
  "@jsenv/url-meta": "8.4.2",
37
37
  "@jsenv/abort": "4.3.0",
38
38
  "@jsenv/utils": "2.1.1"
@@ -1,10 +1,17 @@
1
- import { writeFileSync as writeFileSyncNode, mkdirSync } from "node:fs";
1
+ import {
2
+ writeFileSync as writeFileSyncNode,
3
+ mkdirSync,
4
+ readFileSync,
5
+ } from "node:fs";
2
6
 
3
7
  import { assertAndNormalizeFileUrl } from "../path_and_url/file_url_validation.js";
4
8
 
5
9
  export const writeFileSync = (destination, content = "") => {
6
10
  const destinationUrl = assertAndNormalizeFileUrl(destination);
7
11
  const destinationUrlObject = new URL(destinationUrl);
12
+ if (content && content instanceof URL) {
13
+ content = readFileSync(content);
14
+ }
8
15
  try {
9
16
  writeFileSyncNode(destinationUrlObject, content);
10
17
  } catch (error) {