braidfs 0.0.56 → 0.0.57

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/index.js +10 -4
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -499,11 +499,17 @@ async function proxy_url(url) {
499
499
  file_needs_writing = false
500
500
  let { version, body } = await braid_text.get(url, {})
501
501
  if (!v_eq(version, file_last_version)) {
502
- console.log(`writing file ${fullpath}`)
503
-
504
- // make sure the file has what it had before
502
+ // let's do a final check to see if anything has changed
503
+ // before writing out a new version of the file
505
504
  let text = await require('fs').promises.readFile(fullpath, { encoding: 'utf8' })
506
- if (self.file_last_text != text) crash(new Error('File changed without us noticing.'))
505
+ if (self.file_last_text != text) {
506
+ // if the text is different, let's read it first..
507
+ file_needs_reading = true
508
+ file_needs_writing = true
509
+ continue
510
+ }
511
+
512
+ console.log(`writing file ${fullpath}`)
507
513
 
508
514
  try { if (await is_read_only(fullpath)) await set_read_only(fullpath, false) } catch (e) { }
509
515
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "braidfs",
3
- "version": "0.0.56",
3
+ "version": "0.0.57",
4
4
  "description": "braid technology synchronizing files and webpages",
5
5
  "author": "Braid Working Group",
6
6
  "repository": "braid-org/braidfs",