@wrongstack/persistence 0.309.0 → 0.309.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.
Files changed (2) hide show
  1. package/dist/index.js +11 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -61,10 +61,18 @@ function createPersistencePrimitives(options = {}) {
61
61
  await fs.mkdir(path.dirname(targetPath), { recursive: true });
62
62
  const tmp = tempPathFor(targetPath);
63
63
  try {
64
+ const createMode = opts.mode;
64
65
  if (typeof content === "string") {
65
- await fs.writeFile(tmp, content, { flag: "wx", encoding: opts.encoding ?? "utf8" });
66
+ await fs.writeFile(tmp, content, {
67
+ flag: "wx",
68
+ encoding: opts.encoding ?? "utf8",
69
+ ...createMode !== void 0 ? { mode: createMode } : {}
70
+ });
66
71
  } else {
67
- await fs.writeFile(tmp, content, { flag: "wx" });
72
+ await fs.writeFile(tmp, content, {
73
+ flag: "wx",
74
+ ...createMode !== void 0 ? { mode: createMode } : {}
75
+ });
68
76
  }
69
77
  await commitTemp(tmp, targetPath, opts);
70
78
  } catch (error) {
@@ -76,7 +84,7 @@ function createPersistencePrimitives(options = {}) {
76
84
  await fs.mkdir(path.dirname(targetPath), { recursive: true });
77
85
  const tmp = tempPathFor(targetPath);
78
86
  try {
79
- const handle = await fs.open(tmp, "wx");
87
+ const handle = await fs.open(tmp, "wx", opts.mode);
80
88
  let result;
81
89
  try {
82
90
  result = await write(handle);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrongstack/persistence",
3
- "version": "0.309.0",
3
+ "version": "0.309.1",
4
4
  "license": "MIT",
5
5
  "description": "Dependency-free filesystem persistence primitives shared across WrongStack packages.",
6
6
  "repository": {